Created
September 22, 2013 22:06
-
-
Save simonewebdesign/6664326 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
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