There are same numbers of white balls and red balls (let's say k each), and 2k slots.
Fill all the slots from left to right, and make sure the at any moment, the number of red balls assigned is less or equal than the number of white balls assigned.
For example: 2 balls for each color
- WWRR - Accepted
- WRWR - Accepted
- WRRW - Rejected, because after the second R is assigned, the number of Red (2) is greater than the number if white (1)
- R*** - Rejected, after the second R is assigned, the number of Red (1) is greater than the number if white (0)
in total, 2 accepted solutions
Now the question is, how many different accepted assignments do we have? given the number is K for each color.
we can also explain the question in another way, like there are two actions, EARN A COIN (E) and PAY A COIN (P), and the number of each of them are equal.
How many different arrangement can we have, given at any point, the balance is non-negative