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-12-05 00:50:52 +00:00
|
|
|
[].tap do |products|
|
|
|
|
(100..999).each do |i|
|
|
|
|
(100..999).each do |j|
|
|
|
|
products << i*j
|
|
|
|
end
|
2014-04-25 23:59:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
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
|