Created
October 15, 2015 19:32
-
-
Save jonathanpike/361a3bac07c499f5bcc3 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
def reverse(string) | |
arr = string.split("") | |
n = arr.length | |
index = -1 | |
new = [] | |
until index == (-n - 1) | |
new << arr[index] | |
index -= 1 | |
end | |
puts new.join("") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment