Passing Whiteboard Coding Interviews - The Magical Way

Recall 100 Python Interview Coding Questions with Perfection. 

Write Perfect Code Instantly and with Ease.  100% Correct.  Every time.

OUR MAGICAL WITCHES GUIDE YOUR CODING SPELLS

Save your valuable time

Step 1 - Join FREE

Register FREE.

Step 2 - Memory Palace Python System

Where the magic begins.

Step 3 - Infuse Code

Simply place your code the way we teach.  The Magical Way, and Never forget.  Ever.

Memory Palace Python

Whiteboard Coding Challenge tomorrow?  No worries.

You've got this.  If it's any of The 100 you have applied
our system to, it's in the bag.

Works with any code snippet you choose as well...

Spells 1 - 6

Fibonacci magic "key" is a "Tie" 



Fibonacci magic "key" is a "Tie" 
Association - "fibbing natzi"...lying about 100 magic "ties" he hides under is bed to escape the castle

Problem:
He starts with 0, and adds 1, then 1 to that one, he now has 2 and adds 3 to get 5 magical ties and on and on for 100 magic iterations so, that's 5 added to 3 making 8 and, 8 plus 5 is 13, and so on...

Real Solution:
# Drop 1 - Validate the value of n
def F(n):
if n == 0: return 0
elif n == 1: return 1
else: return F(n-1)+F(n-2)

# Pull out - Compute the next Fibonacci number, remember the previous one
for i in range(0,100):
print(F(i))

Apply Magic:
Drop 1 - Validate the value of n
Pull out - Compute the next Fibonacci number, remember the previous one

Reverse String - magic "key" is Noah

Reverse String - magic "key" is Noah
Association: Noah's boat is made of words and is being reversed and pulled backward by a string

Real Solution:


# Drop 1
Noah_boat = "Hello, World!"     (string is always in " " or ' ' ...)
#  Spell
print(Noah_boat[::-1])





Convert List to String - magic "key" is Ma
Association:  Ma's magic is joining a "list" to create a  "string"  

Real solution:
MaList = ['sun','mon','tue','wed','thu','fri','sat']   #lists are separated by '  ', 
Spell = ' '.join(MaList) # ' '. Ma eyes and . dot to"join" join  - so ' '.join( )
print(Spell)

Apply Magic Cauldron:
Drop 1 - "list"
Drop 2 - the ' '.join( ) spell
Pull out - Print

Palindron - magic "key" is "rye"
Visualize: Sarah Paline bites "rye" bread, turns into a drone "Palindrone"
Palindrome - same word, reversed - ex: Bob, madam

Real Solution:
# Drop 1
SarahPalindrone = 'MADAM'
SarahPalindrone = SarahPalindrone.casefold()
# Spell - Two ingrededients
# ingredient 1
rev_str = reversed(SarahPalindrone)
# ingredient 2
if list(SarahPalindrone) == list(rev_str):
print("The string is a palindrome.")
else:
print("The string is not a palindrome.")

Duplicates - magic "key" is "law"
Association: The "law" is releasing all duplicates from jail

# Drop 1
list = [1, 2, 3, 4, 2, 7, 8, 8, 3];
print("Duplicate elements in given a list/array: ");

# Spell  - for "i"nmates in "range" (ranger Walker) for "j"ail breakers .. compare "if" (list[i] ==list[j]: tthen, print "j"ail breakers list

for i in range(0, len(list)):
for j in range(i+1, len(list)):
if(list[i] == list[j]):
#Pull out
print(list[j])

Duplicates - magic "key" is "shoe"
Visualize: Gigantic "shoe" is releasing 1 word of a sentence at a time

# Drop 1
s = 'You should hire me like yesterday.'
# Spell - Gigantic shoe using a magnifying glass "len" to .split( ) the words one at a time to count them so - print(len(s.split()))

Spells 7 - 12

# Milking "elements" out of a Cow's "list"(tits) goes moo 1st then, moo in reverse .sort"a"(reverse = True/False) #2
moo = [24, 55, 78, 64, 25, 12, 22, 11, 1,2,44,3,122, 23, 34]
# moo sorta reverse (True pr False)? 
moo.sort(reverse = False)
print(moo)

Sort with No .sort( ) function - magic "key" is "ivy"
Association: , printing

# Ivy list 1st then, declare new-list[]
ivylist = [24, 55, 78, 64, 25, 12, 22, 11, 1, 2, 44, 3,122, 23, 34]
new_list = []

# Spell - "while" "drop 1" minimum num "for" "x in drop 1 and >= minimum
while ivylist:
minimum = ivylist[0] # lowest number
for x in ivylist and x >= minimum:

new_list.append(minimum)
ivylist.remove(minimum)

print(new_list)

Prime numbers between range - magic "key" is "bee"
Visualization: transformer bee looks like optimus "Prime"

# Drop 1
for num in range(100, 200):
# Spell - 
if all(num % i != 0 for i in range(2, num)):
print(num)

Reverse list - magic "key" is "toes"
Visualize: Toes "list"ed in reverse order [::-1]

# Drop 1
list = [21,1,3,4,5,6,7,8,9,19,34,36,48,50,51]
print("list is reversed")
# Spell - [::-1]
print(list[::-1])


# Drop 1
def search(arr, x):
# Spell - 
     for i in range(len(arr)):
          if arr[i] == x:
               return i
     print('Not present in the list')
l = [1, 2, 3, 4, 4, 5, 5, 6, 1]

search(l, 4)


def deleteReoccurringCharacters(string):

seenCharacters = set()
outputString = ''
     for char in string:
          if char not in seenCharacters:
          seenCharacters.add(char)
     outputString += char
     return outputString


deleteReoccurringCharacters("mississippi")






Spells 13 - 18

# Drop 2 strings in
one = "Sherm"
two = 'should be hired immediately'
# Spell - asked for a program using join( )
using_join = ''.join((one, two))
# Print this one just for fun
print(str(one), (str(two)))

int(anyData) # into integer
str(anyData) #into string
float(anyData) #into float
tuple() #convert to tuple
set() #returns the type after converting to set
list() #any data type to a list
dict() #convert a tuple of order (key,value) into a dictionary
ord(chr) #character into number
hex(int) #integer into hexadecimal string
oct(int) #integer into octal string
complex(real,imag) #converts real numbers to complex(real,imag) number

Strings:
#linear

def reverse(s):
str = ""
for i in s:
str = i + str
return str

#splicing
'hello world'[::-1]

Lists:
#splice
my_list = [1, 7, 9, 11, 12, 20]
# Reverse a list by using a slice
print(my_list[::-1])

#using reverse()
my_list = [1, 2, 3, 4, 5, 6]

my_list.reverse()
print(my_list)

Tuple:
languages = ('C++', 'Python', 'Scratch')
#Method1:
languages = tuple(reversed(languages))
print(languages)
#Method2:
lang = languages[::-1]
print(lang)

Set:
convert to list then, back to tuple

Dictionary:

def inverse_dict(my_dict):
"""
the func get a dictinary and reverse it, the keys become values and the values become keys.
:param my_dict: the dictinary that need to be reversed.
:return: a VERY pretty dictionary.
"""
result_dict = {}
for key, value in my_dict.items():
if not value in result_dict.keys():
result_dict[value] = []
result_dict[value].append(key)
return result_dict, print(result_dict)

var = [expression1] if [condition] else [expression2]
#example
a, b = 10, 20
# Copy value of a in min if a < b else copy b
min = a if a < b else b 

coming soon...

YComing soon...

© 2021 Memory Palace Python. All Rights Reserved.