Created
April 20, 2012 08:19
-
-
Save hc5/2427093 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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