← All problemsSign in

Help a Thief

Chotu is a thief. He wants to loot money from a society having $N$ (numbered $1$ to $N$) houses in a single line. For each valid i, the thief steals $X$$i$ amount of money from the $i$-th house. But he is a weird person and follows a certain rule when looting the houses.According to the rule,he will never loot two consecutive houses. At the same time, he wants to maximise the amount he loots. The

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