← All problemsSign in

Best Seats

CodeChefRating 848Open on judge ↗

Chef and Chefina are trying to watch a cricket game. They have already decided a row of $N$ seats where they will seat, but they are yet to figure out the exact $2$ seats they will buy. The $i$-th seat in the row costs $A_i$ coins to buy. Obviously, they have to sit next to each other, so they will only buy adjacent seats. Can you figure out the minimum cost for them to buy $2$ seats such that t

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