Created
February 11, 2016 06:47
-
-
Save cpjk/d5d69e9be765d0d3b797 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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