euler/crystal/euler004.cr

16 lines
285 B
Crystal
Raw Permalink Normal View History

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-25 03:32:39 +00:00
def solution
products_of_three_digit_nums.select { |x| Euler.palindrome?(x) }.max
end
end
end