Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Maintain two minheaps: one for the left and one for the right.
Compare the top element from two heaps and remove the appropriate one.
Add a new element to the heap and maintain its size as k.