PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Nuro

Find gaps between intervals

Last updated: Mar 29, 2026

Quick Overview

This question evaluates interval manipulation and range-coverage reasoning, testing skills in sorting, merging overlapping ranges, and handling boundary conditions within the Coding & Algorithms domain.

  • medium
  • Nuro
  • Coding & Algorithms
  • Software Engineer

Find gaps between intervals

Company: Nuro

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of integer intervals `intervals`, where each interval is represented as `[start, end]` (inclusive), and `start <= end`. Two intervals may overlap or touch (e.g., `[1,3]` and `[4,6]` touch if you consider integers, because there is no missing integer between 3 and 4). Your task is to find **all gaps** (missing ranges) **between** the covered portions of the number line. More precisely: 1. Consider the union of all intervals. 2. Let `minCovered` be the smallest integer covered by any interval, and `maxCovered` be the largest integer covered by any interval. 3. Return a list of **all maximal missing integer ranges** within `[minCovered, maxCovered]` that are **not covered** by the union. Return the gaps as a list of disjoint intervals `[gapStart, gapEnd]` (inclusive), sorted by `gapStart`. ### Example - Input: `[[1,3],[7,10],[2,4]]` - Covered union is `[1,4] ∪ [7,10]` - Gaps within `[1,10]` are `[[5,6]]` - Output: `[[5,6]]` ### Notes / Edge cases - If the union is already contiguous (no gaps), return `[]`. - Overlapping intervals should not create gaps. - Intervals may be unsorted. ### Constraints (reasonable interview assumptions) - `1 <= len(intervals) <= 2e5` - Interval endpoints fit in 32-bit signed integers.

Quick Answer: This question evaluates interval manipulation and range-coverage reasoning, testing skills in sorting, merging overlapping ranges, and handling boundary conditions within the Coding & Algorithms domain.

Related Interview Questions

  • Parse logs and count error codes - Nuro (easy)
  • Group points by distance threshold - Nuro (medium)
  • Find Maximum Path Sum in N-ary Tree - Nuro (hard)
  • Implement BFS and a Job Scheduler - Nuro (hard)
Nuro logo
Nuro
Nov 9, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0

You are given a list of integer intervals intervals, where each interval is represented as [start, end] (inclusive), and start <= end.

Two intervals may overlap or touch (e.g., [1,3] and [4,6] touch if you consider integers, because there is no missing integer between 3 and 4). Your task is to find all gaps (missing ranges) between the covered portions of the number line.

More precisely:

  1. Consider the union of all intervals.
  2. Let minCovered be the smallest integer covered by any interval, and maxCovered be the largest integer covered by any interval.
  3. Return a list of all maximal missing integer ranges within [minCovered, maxCovered] that are not covered by the union.

Return the gaps as a list of disjoint intervals [gapStart, gapEnd] (inclusive), sorted by gapStart.

Example

  • Input: [[1,3],[7,10],[2,4]]
    • Covered union is [1,4] ∪ [7,10]
    • Gaps within [1,10] are [[5,6]]
  • Output: [[5,6]]

Notes / Edge cases

  • If the union is already contiguous (no gaps), return [] .
  • Overlapping intervals should not create gaps.
  • Intervals may be unsorted.

Constraints (reasonable interview assumptions)

  • 1 <= len(intervals) <= 2e5
  • Interval endpoints fit in 32-bit signed integers.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Nuro•More Software Engineer•Nuro Software Engineer•Nuro Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.