2018-02-21 23:07:31 +00:00
|
|
|
require "./euler"
|
|
|
|
|
2018-02-25 03:32:39 +00:00
|
|
|
module Euler
|
|
|
|
module Problem004
|
|
|
|
extend self
|
|
|
|
|
|
|
|
def products_of_three_digit_nums
|
|
|
|
(100..999).to_a.combinations(2).map { |p| p.product }
|
|
|
|
end
|
2018-02-21 23:07:31 +00:00
|
|
|
|
2018-02-25 03:32:39 +00:00
|
|
|
def solution
|
|
|
|
products_of_three_digit_nums.select { |x| Euler.palindrome?(x) }.max
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|