Implement with a heap:
merge_k(lists): merge k sorted lists into one sorted list in O(N log k)kth_smallest(lists, k): the k-th smallest (1-based) element across all lists, popping only k timessmallest_range(lists): the smallest range [lo, hi] that includes at least one number from every list. Compare ranges by width hi - lo, and break ties by the smaller lo. Keep one pointer per list in a min-heap, track the current maximum, and advance the list that holds the minimum.