Skip to content

Instantly share code, notes, and snippets.

@joedougherty
Created December 18, 2020 05:19
Show Gist options
  • Save joedougherty/2a78bcd2cdc6ce808e1543fa91fc66f8 to your computer and use it in GitHub Desktop.
Save joedougherty/2a78bcd2cdc6ce808e1543fa91fc66f8 to your computer and use it in GitHub Desktop.
def f(nth):
stack = [0, 1]
for _ in range(nth):
stack = [stack[1], stack[0]] # swap
stack.append(stack[0]) # over
stack[1] = stack[1] + stack[2] # +
stack.pop()
return stack[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment