From charlesreid1

Revision as of 09:01, 1 July 2017 by Admin (talk | contribs)

Problem 4 on Project Euler: https://projecteuler.net/problem=4

Notes

In this problem, we are asked to find the largest palindrome number that is the product of two three-digit numbers.

This problem has one main task:

  • Turning numbers into strings (to check if palindrome)

Normally, Project Euler problems present you with a huge, intractable problem space, and you must spend some time up front eliminating or narrowing down the space you are exploring. But in this case, the key space of all products of all three-digit numbers is trivial to generate, so we do it. Then take the maximum.

Basic structure:

  • For each combination of three digit numbers:
  • Add the product to a set
  • Compute the maximum of the set