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.
That behaviour is not a problem. The only situation where duplicates matter is when the cost is exactly half the money. E.g. you have 16 coins and the flavour costs 8. If there is another one costing 8, that's your solution. Other duplicates don't matter (you will never need more than one flavour with that cost). They can't even be part of the solution. Because the solution is unique as per problem description and duplicates would create multiple solutions.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
That behaviour is not a problem. The only situation where duplicates matter is when the cost is exactly half the money. E.g. you have 16 coins and the flavour costs 8. If there is another one costing 8, that's your solution. Other duplicates don't matter (you will never need more than one flavour with that cost). They can't even be part of the solution. Because the solution is unique as per problem description and duplicates would create multiple solutions.