https://leetcode.com/problems/summary-ranges/description/
228. Summary Ranges
給你一個有序整數陣列,如果相鄰的元素是連續的將他們合併,例如:[1,2,3] ==>
[1,3],並把合併過的陣列 [a,b] 依照下列格式轉成字串:
"a->b" if a != b
"a" if a == b
Example 1:
Input: nums = [0,1,2,4,5,7]
Output: ["0->2","4->5","7"]
Explanation: The ranges are:
[0,2]