FastPrepSmallest Range Covering Elements from K Lists
Problems/Smallest Range Covering Elements from K Lists

Smallest Range Covering Elements from K Lists

Snap Inc. logoSnap Inc.● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Snap Inc. phone screen. The report describes the well-known Smallest Range Covering Elements from K Lists problem. It does not give the function signature, examples or limits. Our version is about 95% the same as the reported question.

You are given k nonempty lists of integers, each sorted in nondecreasing order.

Return the inclusive range [left, right] with the smallest width that contains at least one value from every list. If several ranges have the same width, return the one with the smaller left endpoint.

Function

smallestRange(nums: List<List<Integer>>) → int[]

Examples

Example 1

nums = [[4,10,15,24,26],[0,9,12,20],[5,18,22,30]]return = [20,24]

The interval contains 24, 20, and 22, one value from each list, and no narrower interval covers all three lists.

Example 2

nums = [[1,2,3],[1,2,3],[1,2,3]]return = [1,1]

The single value 1 appears in every list.

Constraints

  • 1 <= nums.length <= 3500.
  • Each list contains from 1 through 50 values.
  • The total number of values is at most 10^5.
  • -10^5 <= nums[i][j] <= 10^5.
  • Every list is sorted in nondecreasing order.

More Snap Inc. interview questions

  • ID Allocator with Assign and ReleasePHONE SCREEN · Seen Nov 2026
  • Basic Calculator IIPHONE SCREEN · Seen Oct 2026
  • Stream Cluster Max and MedianPHONE SCREEN · Seen Oct 2026
  • LRU Cache with Thread-Safety Follow-UpPHONE SCREEN · Seen Sep 2026
  • Most Stones Removed with Same Row or ColumnPHONE SCREEN · Seen Sep 2026
  • Report Island Areas in Discovery OrderPHONE SCREEN · Seen Aug 2026
  • Render an Org Chart and Find Skip-Level PairsONSITE INTERVIEW · Seen Nov 2026
  • Peak of an Increasing-Then-Decreasing ArrayONSITE INTERVIEW · Seen Oct 2026
  • Number of Closed IslandsONSITE INTERVIEW · Seen Oct 2026
  • Radar Barrier CrossingONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Detect Security Attacks from Network LogsFireworks AI · PHONE SCREEN
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Top K Frequent ElementsGoogle · PHONE SCREENGoogle interview questions
  • Top K Frequent ElementsApple · PHONE SCREENApple interview questions
  • Top K Frequent ElementsC3.ai · PHONE SCREENC3.ai interview questions
  • Sliding Window MedianNotion · ONSITE INTERVIEWNotion interview questions
  • Sliding Window MedianBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Choose One from Each Set to Minimize the RangeInMobi · OAInMobi interview questions
  • API Rate Limit Violation DetectionTekion · OATekion interview questions

Snap Inc. interview experiences

  • Snap Experienced MLE Onsite Interview Questions: 1 Experience
  • Snap AI Coding Interview, Experienced SWE and MLE: 4 Experiences
  • Snap Experienced MLE Virtual Onsite: 1 Experience
All Snap Inc. interview questionsSee Snap Inc. hiring insights
Saved
class Solution {
    public int[] smallestRange(List<List<Integer>> nums) {
        // write your code here
    }
}
Checking account…