Created
October 2, 2012 03:53
-
-
Save prettymuchbryce/3816067 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 isPalindrome(value) | |
list = value.split("") | |
j = 0 | |
i = list.length-1 | |
while j <= i | |
if value[j] != value[i] | |
return false | |
end | |
j+=1 | |
i-=1 | |
end | |
return true | |
end | |
#between 100 & 1000 | |
palindromes = 0 | |
for i in 100..1000 | |
if isPalindrome(i.to_s) | |
palindromes+=1 | |
end | |
end | |
puts "" | |
puts palindromes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment