← All problemsSign in

Withdrawing Balls

You are given a bag full of 2N balls of which N balls are black in colour and N are white. All the balls of same colour are identical to each other. You are given the task to withdraw all the balls one by one until the bag gets empty. Now, you have always liked black colour over white. So, being a nerd, you want to withdraw the balls in such a way that at any point you don't want the number of wh

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