Narrowest Range Touching Every List
Each list in lists is sorted in non-decreasing order. Find the narrowest range [low, high] that holds at least one number from every list. A range is narrower when high - low is smaller, and among equally narrow ranges the one with the smaller low wins.
Return it as [low, high].
Example 1
lists [[1,9,20],[4,12],[7,10,30]]
returns [9,12]
9, 12 and 10 lie between 9 and 12, one from each list. No narrower range touches all three lists.
Example 2
lists [[5],[5],[5]]
returns [5,5]
All three lists hold 5, so a range of width 0 is enough.
Constraints
1 <= len(lists) <= 201 <= len(lists[i]) <= 20-105 <= lists[i][j] <= 105
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.