首页 > 代码库 > 一道题目- Find the smallest range that includes at least one number from each of the k lists

一道题目- Find the smallest range that includes at least one number from each of the k lists

You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists. 

For example, 
List 1: [4, 10, 15, 24, 26] 
List 2: [0, 9, 12, 20] 
List 3: [5, 18, 22, 30] 

The smallest range here would be [20, 24] as it contains 24 from list 1, 20 from list 2, and 22 from list 3.

 

https://www.careercup.com/page?sort=votes

 

我的思路是先取最小的triple,然后最小的那个,增加。迭代。

 

一道题目- Find the smallest range that includes at least one number from each of the k lists