← All problemsSign in

Interest Accumulation

CodeChefRating 2445Open on judge ↗

For an array $A$ of size $N$, we define $f(A)$ in the following way: - Start with $score = 0$, and your hand is empty. - For each day $i = 1, 2, \ldots, N$, repeat the following steps in **this order**: - If your hand is empty, you may choose to pick up the current item with worth $A_i$, or you may choose not to. - If your hand contains an item, you may choose to sell the item and add

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