Created
September 5, 2011 14:13
-
-
Save kspaans/1195084 to your computer and use it in GitHub Desktop.
idiotic reverse of words in a list
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
while exists words: | |
if first word == second word: | |
exit() | |
i := start of first word | |
j := start of last word | |
if length of first word != length of last word: | |
MAGIC_SPECIAL_CASE() | |
len := length of first word | |
for len: swap(str[i++], str[j--]) | |
bounds are now second word and second last word |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment