Https://www.codechef.com/viewsolution/33602911

Hello CodeChef,

Problem: ZCO14003

Contest: LRNDSA01

My Solution: https://www.codechef.com/viewsolution/33602911

My code ran successfully for all testcases. But i don’t understand why half of the testcase was failing, if i was using TreeSet instead of ArrayList.

TreeSet does not allow duplicate values so if the input has 2 or more person with same budget, your code with TreeSet will fail.