1807. 斐波纳契数列简单
中文
English
Find the Nth number in Fibonacci sequence.
A Fibonacci sequence is defined as follow:
- The first two numbers are 0 and 1.
- The i th number is the sum of i-1 th number and i-2 th number.
The first ten numbers in Fibonacci sequence is:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34 ...
样例
Example 1:
Input: 1
Output: 0
Explanation:
return the first number in Fibonacci sequence .
Example 2:
Input: 2
Output: 1
Explanation:
return the second number in Fibonacci sequence .
注意事项
N <= 20