86. Generate Fibonacci Number
Share
medium - accepted / - tried
011 = 0 + 12 = 1 + 13 = 1 + 25 = 2 + 38 = 3 + 513 = 5 + 8....[0,1,1,2,3,5,8,13 ...]
Given 2 initial numbers, we can generate a sequence by adding the sum of last two numbers as a new lement.
This is Fibonacci number.
You are asked to create a fib(n)
function, which generate the n-th Fibonacci number.
What is the time & space cost of your solution?