Maximum running product for a string of numbers - MATLAB Cody - MATLAB Central

Problem 54. Maximum running product for a string of numbers

Difficulty:Rate

Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Specifically, given s return the index i to the first of those five numbers. You can assume the maximum product is unique.

Example:

 Input  s = '123454321'
 Output i = 3

since the product of [3 4 5 4 3] is larger than any of the alternatives.

Inspired by Problem 8 from Project Euler

Solution Stats

69.78% Correct | 30.22% Incorrect
Last Solution submitted on May 09, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers2213

Suggested Problems

More from this Author96

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!