The lesson says the optimal space complexity is O(n). Can we reduce this to constant space?
def climb_stairs(nums):
old = new = 1
for i in range(2, nums + 1):
new, old = old + new, new
return new
Course: Grokking Coding Interview Patterns in Python - Learn Interactively
Lesson: Climbing Stairs - Grokking Coding Interview Patterns in Python