Created
February 20, 2013 11:35
-
-
Save sidazhang/4994927 to your computer and use it in GitHub Desktop.
reverse words
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
def reverse_words(array) | |
results = array.split(" ") | |
new_results = [] | |
results.length.times do |i| | |
new_results[i] = results[i].reverse | |
end | |
return new_results.join(" ") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment