Created
February 28, 2015 06:08
-
-
Save cyan-at/c80cbadf0c1c7325b695 to your computer and use it in GitHub Desktop.
This file contains 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 void stutter(ArrayList<String> list) { | |
int l = list.size(); | |
// seed | |
for (int i = 0; i < l; i++){ | |
list.add(""); | |
} | |
// work backwards | |
int f = list.size() - 1; | |
for (int i = l - 1; i >= 0; i--){ | |
String temp = list.get(i); | |
list.set(f, temp); | |
list.set(f-1, temp); | |
f = f - 2; | |
} | |
// f should be 0 | |
// i should be 0 | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment