top of page

Problem 08
This is a C++ solution to Project Euler problem 08 found at: https://projecteuler.net/problem=8
My Algorithm
For this problem, we are given a huge 1000-digit number and are asked to find the thirteen adjacent digits that have the greatest product and return this product. To do this, we can use a nested for-loop to go through all possible combinations of thirteen adjacent digits. For each digit, we need to convert it into a numerical digit by subtracting a '0'. Finally, we can keep a running current product of each set of thirteen adjacent digits and check if it was greater than the previous set of digits. If it is, then we set it equal to the largest product. We can then return the final answer of 23514624000.
Full Solution on GitHub
bottom of page