import java.util.ArrayList; public class Solution { public ArrayList<ArrayList<Integer> > FindContinuousSequence(int sum) { ArrayList<ArrayList<Integer>> list = new ArrayList<>(); for(int i=1,j=1,s=1;i<sum;i++){ while(s<sum){ j++; s+=j; } if((s==sum)&&(j-i>0)){ ArrayList<Integer> mlist =new ArrayList<>(); for(int k=i;k<=j;k++){ mlist.add(k); } list.add(mlist); } s-=i; } return list; } }