Skip to content

Instantly share code, notes, and snippets.

@cpjk
Created February 11, 2016 06:47
Show Gist options
  • Save cpjk/d5d69e9be765d0d3b797 to your computer and use it in GitHub Desktop.
Save cpjk/d5d69e9be765d0d3b797 to your computer and use it in GitHub Desktop.
def palindrome?(s)
s = s.downcase.split(/[^a-zA-Z0-9]+/).join.split ""
s.zip(s.reverse).each do |letters|
return false if letters[0] != letters[1]
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment