Practice · 1 of 3
The Two Coins State
CHALLENGE
Difficulty: advanced+25 XP
**Scenario.** Walk a 1-D board of n cells; at cell i you may gain a[i] but every 3rd step you instead pay 5. What is the minimal correct state? **Which approach is the best fit? The program only needs to print the letter.** **A)** position only — the 3rd-step rule is deterministic **B)** position × (steps taken mod 3) **C)** position × total paid so far **D)** position × number of payments remaining
Press Submit to check your solution.
Back to lesson: Practice: DP Synthesis Drills