2 Boxes
You have $2$ boxes, the first having $X$ stones, and the second having $Y$ stones. You want the (absolute) difference between the stones of the $2$ boxes to be exactly $K$. Each second, you can take a stone from the $1^{st}$ box and put it in the $2^{nd}$, or take from the $2^{nd}$ and put it in the $1^{st}$ box. Find the minimum time till the difference between the stones of the $2$ boxes be
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