We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Organizing Containers of Balls

# Organizing Containers of Balls

#### Sort by

recency

#### |

#### 590 Discussions

#### |

Please Login in order to post a comment

This exercise is awful in my opinion The explanation text is written in a super confusing way,

It would be easier to understand if explicitely stated that the numbers of swaps are unlimited and that the containers do not need to be filled with an equal number of balls. Because all of the examples show configurations where that is the case but the 2nd query of the 2nd example which isn't displayed shows a case where in the end there are 3 red, 3 green and 2 blue.

Maybe I'm missing something, but one of the samples looks wrong to me:

This is expected that produces "Possible" but by swapping, the only point it can be reached is

That means, 2nd and 3rd bucket matches criteria, but not first one because there are one "1" as leftover and no remaining "2" to make the bucket to contain only "2".

Got stuck because I forgot the possible swaps will be in the original order, thus needed to be sorted.

Python 3

cpp solution

Swift