Crazy Malvika discovers Crazy Fibonacci function
CodeChefOpen on judge ↗
Malvika was getting bored of the usual Fibonacci problems, and decided to add a little twist to it. She defined a new function **f()** with the following properties: - She'll give you two integers, **A** and **B**. **f(1)** is defined to be **A** and **f(2)** is **B**. - And for all integers **x ≥ 2**, **f(x) = f(x-1) + f(x+1)**. She'll give an integer **N**, and you have to find out what **f(N)
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.
Sign in to chat with the tutor and save your progress.
Sign in to start