Description
The Fibonacci numbers F(n) form a sequence where F(n) = F(n-1) + F(n-2), with F(0) = 0 and F(1) = 1.
Examples
Input:
n = 4Output:
3Explanation:
F(4) = F(3) + F(2) = 2 + 1 = 3.
Input:
n = 0Output:
0Explanation:
F(0) = 0 by definition.
Input:
n = 6Output:
8Explanation:
F(6) = F(5) + F(4) = 5 + 3 = 8. The sequence is: F(0)=0, F(1)=1, F(2)=1, F(3)=2, F(4)=3, F(5)=5, F(6)=8.
Constraints
- •
0 ≤ n ≤ 30