FastPrepMissing Ranges within Inclusive Bounds
Problems/Missing Ranges within Inclusive Bounds

Missing Ranges within Inclusive Bounds

ZipRecruiter logoZipRecruiter● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter phone-screen report describes sorted input, inclusive bounds, maximal missing intervals, writing a single value or a range, and worked non-empty cases. One empty-array output conflicts with those rules, so we use the inclusive reading. Our version is about 92% the same as the reported question.

nums is sorted, contains unique integers, and every value lies inside inclusive [lower, upper].

Return every maximal missing interval in ascending order. Encode a singleton as [x] and a longer interval as [start, end].

Function

missingRanges(nums: int[], lower: int, upper: int) → int[][]

Examples

Example 1

nums = [0,1,3,50,75]lower = 0upper = 99return = [[2],[4,49],[51,74],[76,99]]

Leading, singleton, middle, and trailing gaps are returned in order.

Example 2

nums = []lower = 3upper = 4return = [[3,4]]

The inclusive contract returns the full missing range.

Constraints

  • 0 <= nums.length <= 100000
  • -1000000000 <= lower <= upper <= 1000000000

More ZipRecruiter Phone Screen questions

  • Neighboring Record IDsPHONE SCREEN · Seen May 2026
  • Restaurant Vote LeadersPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2026
  • Most Frequent Word across Grouped ArraysPHONE SCREEN · Seen Sep 2024
  • Starting Value with the Longest Collatz ChainPHONE SCREEN · Seen Apr 2022
  • Classify an Alien Dictionary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
  • Multiset Intersection of Three ListsPHONE SCREEN · Seen Feb 2022
  • Find the Smallest Magic IndexPHONE SCREEN · Seen Dec 2021
  • Website Pair with the Most Common VisitorsPHONE SCREEN · Seen Nov 2021
  • Center-Outward Number SpiralPHONE SCREEN · Seen Jun 2021
  • Fibonacci Number with Constant Extra SpacePHONE SCREEN · Seen Mar 2017

Similar questions at other companies

  • Compact Conversation History by Token BudgetSierra · PHONE SCREENSierra interview questions
  • Remove Duplicates from Sorted ArrayNykaa · PHONE SCREENNykaa interview questions
  • Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions
  • Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
  • Closest Vehicle and Charger in a LineSpotify · PHONE SCREEN
  • Assign CookiesAmazon · PHONE SCREEN
  • Correct an In-Place Array ReversalDuolingo · PHONE SCREENDuolingo interview questions
  • Remove Duplicates From Sorted Array In PlaceKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Merge Two Sorted ArraysCapgemini · PHONE SCREENCapgemini interview questions
  • Remove Duplicates From Sorted Array In PlaceGet My Parking · PHONE SCREEN

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[][] missingRanges(int[] nums, int lower, int upper) {
        // Write your code here.
    }

}
Checking account…