Your question is Fibonacci With Complexity. 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.
CAE engineering simulation workflows may request sequence values at extremely large indices. Implement fibonacci(n, mod) to return the nth Fibonacci number modulo mod, using an algorithm that remains efficient when n is as large as 10^18.
The Fibonacci sequence is defined as F(0) = 0, F(1) = 1, and F(n) = F(n - 1) + F(n - 2) for n >= 2.
n and mod.F(n) % mod.n >= 0 and mod >= 2.def fibonacci(n, mod):