Problem
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.
Example 1
- Input
- [0, 1, 2, 4, 5, 7]
- Output
- ["0->2", "4->5", "7"]
Example 2
- Input
- [0, 2, 3, 4, 6, 8, 9]
- Output
- ["0", "2->4", "6", "8->9"]
Example 3
- Input
- []
- Output
- []
Constraints
0 <= nums.length <= 20-2^31 <= nums[i] <= 2^31 - 1All values are unique and sorted in ascending order.