ctci
ctci copied to clipboard
Rework example 7 and provide an alternative way of solving the problem.
trafficstars
While browsing through the example questions, I kind of got stuck at 11.7 and its proposed solution. After a bit of research, I came up with an alternative way of solving the problem using a heap (T: O(n log(n)), S: O(1)), leaving the original approach relying on a sorted collection in place.