euler/ruby/euler004.rb

16 lines
271 B
Ruby
Raw Normal View History

require_relative 'euler'
2014-04-25 23:59:14 +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
def solution
products_of_three_digits.select { |x| Euler.palindrome?(x) }.max
2014-04-25 23:59:14 +00:00
end