● videoPractice
Practice: Smallest Range of K Lists

Unlock this course
Subscribe for full access to every course, or buy this one on its own.
SECTION
Practice
NEXT UP
Jon Skeet: Creating a C# Linter
COURSE
Coding Interview Bootcamp
17 lessons
About this lesson
This one is a bit tougher so don't feel bad if you don't finish. Again: the point is to demonstrate your thinking process and that you ask enough questions and think things through before you write any code.
Here’s the question:
You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists.
Here's some sample code
<span class="hljs-comment">// For example,</span>
list1 = [<span class="hljs-number">4</span>, <span class="hljs-number">10</span>, <span class="hljs-number">15</span>, <span class="hljs-number">24</span>, <span class="hljs-number">26</span>];
list2 = [<span class="hljs-number">0</span>, <span class="hljs-number">9</span>, <span class="hljs-number">12</span>, <span class="hljs-number">20</span>];
list3 = [<span class="hljs-number">5</span>, <span class="hljs-number">18</span>, <span class="hljs-number">22</span>, <span class="hljs-number">30</span>];
Unlock Coding Interview Bootcamp
Subscribe for full access to every course, or buy this one on its own.