shlogg · Early preview
Md Ariful Haque @mah-shamim

Smallest Range Covering Elements From K Sorted Lists

Find smallest range covering elements from k lists: use min-heap & sliding window to track smallest element from each list. Time complexity: O(n * log k), space complexity: O(k).

632. Smallest Range Covering Elements from K Lists
Difficulty: Hard
Topics: Array, Hash Table, Greedy, Sliding Window, Sorting, Heap (Priority Queue)
You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists.
We define the range [a, b] is smaller than range [c, d] if b - a < d - c or a < c if b - a == d - c.
Example 1:

Input: nums = [[4,10,15,24,26],[0,9,12,20],[5,18,22,30]]
Output: [20,24]
Explanation:

List 1: [4, 10, 15, 24,26], 24 is in range [20,24].
List 2: [0, 9, 12, 20], 20 is in range [20,24].
List...