Smallest Range Covering Elements from K Lists

Hard · Heap & Priority Queue · about 35 minutes

Asked at Google, Amazon, Snap, Uber, Microsoft, Discord, Riot Games, Twitch.

nums contains k lists, each sorted ascending. Find the narrowest interval [a, b] that contains at least one value from every list. One interval beats another when it's narrower (smaller b - a); between equally narrow intervals, the one that starts lower wins. Return [a, b].

Related guides