228. Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.
Example 1:
Example 2:
Thoughts:
record number a as nums[i], if there is a next number and the next number is continuous; update i.
check the nums[i] with original; if it is not equal (i was updated -> add string "a" + "->" + "nums[i]")
else (i was not updated ->only add string "a").
Code
Last updated
Was this helpful?