Limited budget party error

question = https://hack.codingblocks.com/contests/c/452/1239
solution = https://ide.codingblocks.com/#/s/20717

Even if your error is removed ,ur code will get TLE
Use map , it will be done in O(n) in average case
https://ide.codingblocks.com/#/s/20738

1 Like