163 Missing Ranges
163. Missing Ranges
1. Question
Given a sorted integer array where the range of elements are in the inclusive range [lower,upper], return its missing ranges.
For example, given[0, 1, 3, 50, 75]
,lower= 0 andupper= 99, return["2", "4->49", "51->74", "76->99"].
2. Implementation
(1) Scan Line
3. Time & Space Complexity
Scan Line: 时间复杂度O(n), 空间复杂度O(n)
Last updated