PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of sorted array manipulation, interval arithmetic, detection of maximal missing ranges, and careful handling of boundary and edge cases in integer intervals.

  • easy
  • Bytedance
  • Coding & Algorithms
  • Software Engineer

Find Missing Ranges with Bounds

Company: Bytedance

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Given a sorted array of distinct integers `nums` and two integers `lower` and `upper` that define an inclusive interval `[lower, upper]`, return all maximal ranges of integers inside `[lower, upper]` that do not appear in `nums`. Ignore any values in `nums` that fall outside the interval. Represent each missing range as: - `[x]` if exactly one number is missing - `[start, end]` if multiple consecutive numbers are missing Example: - Input: `nums = [3, 5, 10]`, `lower = 0`, `upper = 9` - Output: `[[0, 2], [4], [6, 9]]` Return the missing ranges in ascending order.

Quick Answer: This question evaluates understanding of sorted array manipulation, interval arithmetic, detection of maximal missing ranges, and careful handling of boundary and edge cases in integer intervals.

Return all maximal missing integer ranges inside [lower, upper], using [x] for singletons.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([3,5,10], 0, 9)

Expected Output: [[0, 2], [4], [6, 9]]

Explanation: Missing ranges are inside the inclusive bounds.

Input: ([], 1, 3)

Expected Output: [[1, 3]]

Explanation: All values in the range are missing.

Input: ([-5,0,1,2,10], 0, 2)

Expected Output: []

Explanation: Values outside the interval are ignored.

Input: ([1,3], 1, 3)

Expected Output: [[2]]

Explanation: A single missing number is represented as [x].

Hints

  1. Clarify edge cases before coding.
  2. Keep outputs deterministic when several valid answers exist.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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.

Related Coding Questions

  • Course Schedule Feasibility - Bytedance (hard)
  • Least Frequently Used (LFU) Cache - Bytedance (hard)
  • SQL: Students Above Average and Passing Every Subject - Bytedance (hard)
  • Determine If One Binary Tree Is a Substructure of Another - Bytedance (hard)
  • Reverse Nodes in K-Sized Groups - Bytedance