All labs ยท ๐งฎ Algorithms & interviews
See how algorithms think
Watch sorting, searching, path-finding and recursion step by step โ then solve real interview challenges, timed and checked by hidden tests.
๐ Free demo: try the first 2 lessons and the first tool. Subscribe to unlock everything here and in all the other labs โ USD 10 a month (USD 100 a year), or included with lessons.
โจ SubscribeLog in
comparing moving in place
The Python behind it
Linear search โ look at every item, one by one
Binary search โ look in the middle, throw away half
๐ฏ Guess my number (1 โ 100)
I'm thinking of a number. Can you find it in 7 guesses or fewer? Hint: always guess the middle of what's left.
Draw:
def fib(n):
if n < 2: # the base case stops the calls
return n
return fib(n - 1) + fib(n - 2) # the function calls itself
works it out base case remembered โ no more calls