Piles of Coins
CodeChefOpen on judge ↗
There are $n$ piles of coins numbered from 1 to $n$. $i$-th pile has $c_i$ coins. You cannot pick two adjacent piles of coins. What is the maximum number of coins you can pick? ###Input: - First line contains an integer: $n$ - Second line contains $n$ space-separated integers: $c_1,\ c_2,\ \dots,\ c_n$ ###Output: - Integer denoting maximum number of coins you can collect. ###Constr
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