BROKEN HEART
CodeChefOpen on judge ↗
In a serious conflict between AbhiRam and Divya ,she happens to break a glass bowl into N pieces each of size Si. AbhiRam to make up for his mistake wants to join the N pieces to make the bowl intact again. In the process of joining the pieces he learns from the shopkeeper that to join two pieces of sizes A and B the cost is |A-B| . Abhi wants to know the minimum cost possible C, help him find tha
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