Skip to content

Instantly share code, notes, and snippets.

@prettymuchbryce
Created October 2, 2012 03:53
Show Gist options
  • Save prettymuchbryce/3816067 to your computer and use it in GitHub Desktop.
Save prettymuchbryce/3816067 to your computer and use it in GitHub Desktop.
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