HOSTEL ROBBER
CodeChefOpen on judge ↗
There is a hostel robber in PSG Tech hostels. He has a strategy to rob the rooms without getting noticed. The strategy is simple. He only robs atmost two contiguous rooms. The ith room in the hostel will have a[i] items. Once he robs a room he takes all the items in that room. He wants to rob exactly $P$ items. If he robs more than $P$ items or less than $P$ items he will get caught. Each room h
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