Back to problems

Find the Smallest Range Covering K Sorted Lists

Algorithm · Snapchat · Hard

You are given nums, a list of k non-empty integer lists. Every nums[i] is sorted in nondecreasing order. Implement smallest_covering_range(nums) so that it returns a two-element list [left, right] representing a closed interval that contains at least one integer from each of the k lists. Among all intervals with that property, select the one with the smallest width $$right - left$$. If several intervals have the same smallest width, return the interval with the smallest left…

Checking your access…