Skip to content

Instantly share code, notes, and snippets.

@leekiernan
Created October 21, 2013 23:54
Show Gist options
  • Save leekiernan/7092930 to your computer and use it in GitHub Desktop.
Save leekiernan/7092930 to your computer and use it in GitHub Desktop.
def is_palindrome(int)
int.to_s == int.to_s.reverse
end
palindromes = []
# start high
[*100...1000].reverse.each do |x|
[*100...1000].reverse.each do |y|
z = x*y
if is_palindrome(z)
palindromes << z
end
end
end
p palindromes.sort.last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment