Fibonacci_bottomUp

Run Settings
LanguagePython
Language Version
Run Command
def fib(num): memo = [None for _ in range(num+1)] memo[0] = 0 memo[1] = 1 memo[2] = 1 for idx in range(3, num+1): memo[idx] = memo[idx-1] + memo[idx-2] return memo[num] print("Hello World!") memo = [] sample1 = 5 result1 = fib(sample1) print(f"result1: {result1}") assert(result1 == 5) memo = [] sample2 = 7 result2 = fib(sample2) print(f"result2: {result2}") assert(result2 == 13) memo = [] sample3 = 9 result3 = fib(sample3) print(f"result3: {result3}") assert(result3 == 34) print("good bye world")
Editor Settings
Theme
Key bindings
Full width
Lines