Find Missing Ranges with Bounds
Company: Bytedance
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
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.
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
- Clarify edge cases before coding.
- Keep outputs deterministic when several valid answers exist.