Magic Warehouse
CodeChefOpen on judge ↗
Aadi and Abhi are two friends. One day they went to a magic warehouse.There they found $N$ boxes in a row,each box is assigned with weight $W$i.Now Aadi challenged Abhi to find out the minimum sum of absolute differences between two adjacent weight of boxes.To get minimum possible sum Abhi can swap Weight of $i$th box with weight of either $(i-1)$th or $(i+1)$th box or keep as it is. i.e. (the wei
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