Created
October 21, 2013 23:54
-
-
Save leekiernan/7092930 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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