Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Created September 22, 2013 22:06
Show Gist options
  • Save simonewebdesign/6664326 to your computer and use it in GitHub Desktop.
Save simonewebdesign/6664326 to your computer and use it in GitHub Desktop.
max = 0
100.upto(999) { |a|
a.upto(999) { |b|
prod = a * b
max = [max, prod].max if prod.to_s == prod.to_s.reverse
}
}
puts "Maximum palindrome is #{ max }."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment