The Fibonacci numbers are F(0) = 0, F(1) = 1, F(k) = F(k - 1) + F(k - 2). Return F(n) modulo 10**9 + 7.
For n = 10 the answer is 55.
The starter code adds up one number at a time. It is correct but far too slow when n is huge.
Example 1
Input:
fib_mod(10)
Output:
55
Example 2
Input:
fib_mod(0)
Output:
0
0 <= n <= 9 * 10**15No results yet
Run your code to check it against the examples, or submit to run every test.