← All problemsSign in

Precious Stones

A robber enters a house and finds a treasure box kept inside the cupboard. It contains a string of "n" precious stones of values - a1,a2,a3,...an connected with a chain, open at both ends. The robber wishes to take the entire string along with him, but the chain is too heavy for the robber to carry. Also, he has to hurry as he might get caught anytime. So he decides to choose a stone randomly, bre

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