Kth Smallest Number in M Sorted Lists
Try to solve the Kth Smallest Number in M Sorted Lists problem.
We'll cover the following
Statement
Given an number of sorted lists in ascending order and an integer, k
, find the smallest number among all the given lists.
Although there can be repeating values in the lists, each element is considered unique and, therefore, contributes to calculating the smallest element.
If k
is greater than the total number of elements in the input lists, return the greatest element from all the lists, and if there are no elements in the input lists, return 0.
Constraints:
-
m
-
list[i].length
-
list[i][j]
-
k
Examples
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy