I was wondering if there was any chance that the solution could add in a more intuitive explanation of how to go from the N^2 solution to arrive at the 2 heap solution.

It seems rather difficult to be able to go from the problem β O(n^2) β 2 heap solution. I mean someone had to have arrive at the solution somehow and I am hoping how I could gain the intuition of how to get there rather than memorize a solution.

Thanks!

Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968

Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5028748841713664