思想:滑动窗口。窗口内左闭右开。
public int[][] findContinuousSequence(int target){
int left=1;
int right=1;
int sum=0;
List<int[]> res=new ArrayList<>();
while(left<=target/2){
if(sum<target){
sum+=right;
right++;
}
else if(sum>target){
sum-=left;
left++;
}
else{
int[] temp=new int[right-left];
for(int i=left;i<right;i++){
temp[i-left]=i;
}
res.add(temp);
sum-=left;
left++;
}
}
return res.toArray(new int[res.size()][]);
}