Fibonacci Number
Easy
Topics
The Fibonacci numbers satisfy F(0)=0, F(1)=1, and F(n)=F(n-1)+F(n-2) for n > 1. Given n, return F(n).
Example 1
Input: n = 2 Output: 1
Example 2
Input: n = 4 Output: 3
Constraints
- 0 <= n <= 30
Run ⌘' · Submit ⌘⏎