Impossibly Iterative Fibonacci

Start Timer

0:00:00

Upvote
4
Downvote
Save question
Mark as completed
View comments (2)

Write a function fib which takes an integer n and returns the nth fibonacci number. For this question, fib MUST be recursively defined.

Note: for and while keywords are disabled for this question, as well as functools. Any workarounds around this restriction is prohibited.

Example:

Input:

n = 4

Output:

def fib(n) -> 3
# the sequence is [1, 1, 2, 3, 5, 8...]
.
.
.
.
.


Comments

Loading comments