Cody

Problem 54. Maximum running product for a string of numbers

Created by Cody Team in Cody Challenge

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

60.25% Correct | 39.75% Incorrect
Last solution submitted on Dec 13, 2018

Problem Comments

Solution Comments

Recent Solvers676

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!