Skip to content

Instantly share code, notes, and snippets.

@hc5
Created April 20, 2012 08:19
Show Gist options
  • Select an option

  • Save hc5/2427093 to your computer and use it in GitHub Desktop.

Select an option

Save hc5/2427093 to your computer and use it in GitHub Desktop.
public static ArrayList<Integer> cumSum(ArrayList<Integer> s, int acc){
ArrayList<Integer>l = new ArrayList<Integer>();
try{
(l = new ArrayList<Integer>(Arrays.asList(new Integer[]{s.remove(0)+acc}))).addAll(cumSum(s,l.get(0)));
}
finally{
return l;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment