CANDY PARTY
CodeChefOpen on judge ↗
Papa always do the following magic trick with Abhinav. He puts W white candies and B black candies in his cap and asks Abhinav, to remove pairs of candies in whatever order he would desire. After removing a pair of candies, Abhinav is asked to place a white candy back into the cap if they are the same color. Otherwise he is asked to place a black candy into the cap. When Abhinav is left with only
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