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.
I hate how people just paste the code instead of hinting what should be done in these challenges, so lazy...
The clue here is not to focus on how to move these balls, rather than that we need to determine if such combination of balls and containers is even possible.
If you read the intro, there is no mention of how many balls can be stored in the container, but if the only move we have is to switch two balls between containers, that means that the total capacity of the containers do not change. What if we have a lot of balls in single color, but no container can fit them all? Or if we have just 1 ball, but all the containers have capacity of at least two? These are the cases you should focus on.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Organizing Containers of Balls
You are viewing a single comment's thread. Return to all comments →
I hate how people just paste the code instead of hinting what should be done in these challenges, so lazy...
The clue here is not to focus on how to move these balls, rather than that we need to determine if such combination of balls and containers is even possible. If you read the intro, there is no mention of how many balls can be stored in the container, but if the only move we have is to switch two balls between containers, that means that the total capacity of the containers do not change. What if we have a lot of balls in single color, but no container can fit them all? Or if we have just 1 ball, but all the containers have capacity of at least two? These are the cases you should focus on.