163. Missing Ranges
Problem
Return a list of ranges missing from [lower, upper] given a sorted integer array.
Given a sorted integer array nums (with no duplicates) and two integers lower and upper, return all the missing ranges from lower to upper (inclusive).
Each range should be represented as a string in the format "lower->upper" (if lower != upper) or just the number (if lower == upper).
Examples
Input: [[0,1,3,50,75],0,99]
Output: ["2","4->49","51->74","76->99"]
Input: [[],1,1]
Output: ["1"]
Hints
Track the previous number and check gaps between consecutive elements.
Handle edge cases for the start (before first element) and end (after last element).
Generate the range string format correctly for single elements vs ranges.
Related Problems
163. Missing Ranges
Return a list of ranges missing from [lower, upper] given a sorted integer array.