LTIME35 - KSUM

This problem can be solved by using a priority queue.

My solution : https://www.codechef.com/viewsolution/9984949

Idea is keep a pointer from each element to the last element , and decrement the pointer to the previous element if the subbarray sum is popped out.

To do this we can use a priority queue , pop out and print the largest sum and then modify the pointer and push it back to the queue.

the solutions are not made public yet…

2 Likes