← All problemsSign in

Fibonacci Redefined

Problem description. We redefine the fibonacci series such that, now every term in the series is sum of previous term and twice the term previous to previous term . That means F(i) = F(i-1) + 2*F(i-2) for i >=3 . The first 2 elements of the series will a and b ,which implies F(1) = a and F(2) = b ,which will given as input . Your job is to calculate F(i) % 1000000007 , for every test case , where

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start