← All problemsSign in

Remove the dirt

Alice has $N$ jars each consisting of a specific amount of dirt $A$$i$. Now she starts playing with those jars. She wants to repeat the following operations exactly $N-1$ times until she is left with only one jar.Initial dirt value is 0 - Selects two random jars . let's denote them as $i$ and $j$. - Adds $A$$i$+$A$$j$ dirt value in a book where $A$$i$ and $A$$j$ are their respective dirt amounts

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