Skip to content

Instantly share code, notes, and snippets.

@bgmarx
Created April 17, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgmarx/c847a56c2cc33b5395ea to your computer and use it in GitHub Desktop.
Save bgmarx/c847a56c2cc33b5395ea to your computer and use it in GitHub Desktop.
reverse implementation
def rev(str)
lp = 0
rp = str.length - 1
while lp < rp
temp = str[lp]
str[lp] = str[rp]
str[rp] = str[lp]
lp += 1
rp -= 1
end
str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment