← All problemsSign in

Happy Birthday

Today is Chef's Birthday. He has two friends Bob and Alice. He wants to give chocolate to both in equal amount (in terms of weight). He has two jars of chocolates, but the weight of chocolates are different. Help Chef to equal the weight of both the jars by swapping only one chocolate. So you can take any chocolate (having any weight) from first jar and any chocolate from second jar and swap it.

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