← All problemsSign in

Problem 2 -- Highly Recursive Function

Professor Plums likes recursion, but his students typically find it confusing. During a recent faculty meeting his mind wandered, and he invented the following recursive mathematical function, H(n): - H(n) = H(n+4) + H(n+2) for all value of n < -5 - H(n) = n*2 for all value of -5 $\leq$ n $\lt$ 2 - H(n) = H(n-8) - H(n-4) + H(n-3) for all values of n $\geq$ 2. He wants you to write a pr

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