Your question is Dynamic Programming Example. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Airtel Payments Bank uses sequence-based calculations in parts of its transaction and rewards services. Given a non-negative integer n, compute the nth Fibonacci number modulo 1,000,000,007 using dynamic programming.
The Fibonacci sequence is defined as F(0) = 0, F(1) = 1, and F(n) = F(n - 1) + F(n - 2) for n >= 2.
Return F(n) % 1,000,000,007. Your solution should avoid recursion depth issues and should use constant extra space apart from a few variables.
n.1,000,000,007.def fibonacci_mod(n):