Given a sorted integer array without duplicates, return the summary of its ranges.
For example, given [0,1,2,4,5,7]
, return ["0->2","4->5","7"].
[思路]
兩個指針 start, end. 如果nums[end+1] = nums[end]+1, 就移動end指針, 否則, 插入字符串nums[start]->nums[end].
[CODE]
public class Solution { // [0,1,2,4,5,7], return ["0->2","4->5","7"]. public ListsummaryRanges(int[] nums) { List res = new ArrayList<>(); if(nums==null || nums.length<1) return res; int s=0, e=0; while(e