https://www.codechef.com/viewsolution/29296047
My code gives WA. Any test case which break my code?
Thanks!
https://www.codechef.com/viewsolution/29296047
My code gives WA. Any test case which break my code?
Thanks!
I don’t know about test cases but these kind of problems should be solved using priority queues and max heaps because we cannot guarantee whether the maximum element after every iteration
But if we sort the elements, sum of last two elements will always be greater or equal to previous element.
Got it thanks! My logic will be valid only for non-negative numbers.
Yeahh