2014-11-20 19:38:31 +00:00
|
|
|
require_relative 'euler'
|
2014-04-25 23:59:14 +00:00
|
|
|
|
2014-11-20 19:38:31 +00:00
|
|
|
def products_of_three_digits
|
2014-04-25 23:59:14 +00:00
|
|
|
products = []
|
2014-11-20 19:38:31 +00:00
|
|
|
(100..999).each do |i|
|
|
|
|
(100..999).each do |j|
|
2014-04-25 23:59:14 +00:00
|
|
|
products << i*j
|
|
|
|
end
|
|
|
|
end
|
|
|
|
products
|
|
|
|
end
|
|
|
|
|
2014-11-20 19:38:31 +00:00
|
|
|
def solution
|
|
|
|
products_of_three_digits.select { |x| Euler.palindrome?(x) }.max
|
2014-04-25 23:59:14 +00:00
|
|
|
end
|