Summary Ranges
EasyIntervals
Decode it first. Clues, constraints, pattern and plan before any code.nums is a sorted list of unique integers. Describe it as the smallest list of ranges that covers exactly those numbers. Each run of consecutive integers from a to b becomes the string "a->b", and a number on its own becomes "a". Return the ranges in order.
[0, 1, 2, 4, 5, 7] → ["0->2", "4->5", "7"]
[0, 2, 3, 4, 6, 8, 9] → ["0", "2->4", "6", "8->9"]
[] → []Constraints
0 <= nums.length <= 20-2^31 <= nums[i] <= 2^31 - 1- All values are unique and sorted in ascending order.