Skip to content

Commit

Permalink
project 4 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ecamacho committed Jan 23, 2012
1 parent 28978f1 commit 128ec62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Binary file removed problem3/.problem3.rb.swp
Binary file not shown.
Binary file removed problem3/.problem3_2.rb.swp
Binary file not shown.
Binary file removed problem3/.test_problem3.rb.swp
Binary file not shown.
15 changes: 15 additions & 0 deletions problem4.rb
@@ -0,0 +1,15 @@
def largest_palindrom_product_3_digits
max_palindrom = 0
100.upto(999) do |factor1|
100.upto(999) do |factor2|
product = factor1 * factor2
if product.to_s == product.to_s.reverse then
max_palindrom = product > max_palindrom ? product : max_palindrom
end
end
end
return max_palindrom
end


puts largest_palindrom_product_3_digits

0 comments on commit 128ec62

Please sign in to comment.