Given a sorted integer array nums with all distinct values, return the smallest list of ranges that exactly covers every number in nums.
A range represents a maximal consecutive sequence of integers in nums. For each such sequence:
If the sequence contains exactly one number x, output the string "x".
Otherwise, if the sequence starts at a and ends at b, output the string "a->b".
Return the ranges in the same order as they appear in nums.
Constraints:
nums.length
nums[i]
All values in nums are unique.
nums is sorted in ascending order.
Given a sorted integer array nums with all distinct values, return the smallest list of ranges that exactly covers every number in nums.
A range represents a maximal consecutive sequence of integers in nums. For each such sequence:
If the sequence contains exactly one number x, output the string "x".
Otherwise, if the sequence starts at a and ends at b, output the string "a->b".
Return the ranges in the same order as they appear in nums.
Constraints:
nums.length
nums[i]
All values in nums are unique.
nums is sorted in ascending order.