Given `lists`, an array of individually sorted (ascending) integer arrays, implement `mergeKSorted(lists)` returning one sorted array containing all the elements. Use a min-heap for an O(N log k) merge.
+ 2 hidden tests run on Submit.
The heap always holds at most one candidate per list — the current frontier — so its smallest entry is the next element of the merged output. Each of the N elements is pushed and popped once, each operation O(log k). O(N log k) time.
Run your code to see results.