euler/ruby/euler004.rb

16 lines
271 B
Ruby

require_relative 'euler'
def products_of_three_digits
[].tap do |products|
(100..999).each do |i|
(100..999).each do |j|
products << i*j
end
end
end
end
def solution
products_of_three_digits.select { |x| Euler.palindrome?(x) }.max
end