Cody

# Problem 54. Maximum running product for a string of numbers

Solution 353962

Submitted on 17 Nov 2013 by Pedro Villena
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% s = '123454321'; i_correct = 3; assert(isequal(running_product(s),i_correct))

s = 15 18 19 18 15

2   Pass
%% s = '5820974944592307816406286208998628034825342117067'; i_correct = 28; assert(isequal(running_product(s),i_correct))

s = Columns 1 through 16 24 26 22 29 33 28 26 31 24 23 19 21 20 19 22 26 Columns 17 through 32 19 17 18 20 22 24 18 24 25 28 34 40 34 33 24 19 Columns 33 through 45 17 23 17 22 22 22 16 15 11 15 11 15 21

3   Pass
%% s = '141592653589793238462643383279502884197169399399999'; i_correct = 47; assert(isequal(running_product(s),i_correct))

s = Columns 1 through 16 20 21 23 27 25 21 27 30 32 38 36 30 24 25 20 23 Columns 17 through 32 23 26 22 21 18 24 21 19 23 29 26 23 23 24 23 22 Columns 33 through 47 23 30 29 22 24 32 26 28 36 33 33 39 39 39 45

4   Pass
%% s = '7831652712019091456485669234603486104543266482133936072602'; i_correct = 21; assert(isequal(running_product(s),i_correct))

s = Columns 1 through 16 25 23 17 21 21 17 12 11 13 12 19 20 23 19 25 20 Columns 17 through 32 27 28 29 29 34 28 26 24 24 15 16 17 21 21 22 19 Columns 33 through 48 19 16 14 16 18 20 21 21 26 26 21 18 17 18 19 24 Columns 49 through 54 21 25 18 21 15 17

5   Pass
%% s = '70066063155881748815209209628292540917153643678925903600113305305488'; i_correct = 44; assert(isequal(running_product(s),i_correct))

s = Columns 1 through 16 19 12 18 21 16 15 20 22 27 27 29 28 28 28 28 26 Columns 17 through 32 24 16 17 18 13 20 26 19 25 27 27 23 26 22 20 20 Columns 33 through 48 19 21 18 23 17 22 19 21 22 26 28 33 32 31 33 25 Columns 49 through 64 19 23 18 9 10 8 5 8 8 12 14 11 13 17 20 25

6   Pass
%% s = '11111'; i_correct = 1; assert(isequal(running_product(s),i_correct))

s = 5