freeCodeCamp Challenge Guide: Problem 8: Largest product in a series

Problem 8: Largest product in a series


Problem Explanation

  • In this challenge we need to get the largest product of n cosnecutive numbers.
  • We can use the sliding window method to solve this problem.
  • Steps to follow:
    1. Select the first n consecutive numbers.
    2. Find their product.
    3. Compare it to the maximum product yet.
    4. Move the pointer by 1 element.
    5. Repeat the process.
  • This algorithm’s big O is O(n*m) where n is the length of the array and m is the number of consecutive elements.

Solutions

Solutions are not provided for Project Euler challenges.
1 Like