Cody

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

Solution 1920110

Submitted on 3 Sep 2019 by Virtual AS
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 = 1 3 6 10 15 18 19 18 15 10 6 3 1

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

s = Columns 1 through 30 5 13 15 15 24 26 22 29 33 28 26 31 24 23 19 21 20 19 22 26 19 17 18 20 22 24 18 24 25 28 Columns 31 through 53 34 40 34 33 24 19 17 23 17 22 22 22 16 15 11 15 11 15 21 20 13 13 7

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

s = Columns 1 through 30 1 5 6 11 20 21 23 27 25 21 27 30 32 38 36 30 24 25 20 23 23 26 22 21 18 24 21 19 23 29 Columns 31 through 55 26 23 23 24 23 22 23 30 29 22 24 32 26 28 36 33 33 39 39 39 45 36 27 18 9

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

s = Columns 1 through 30 7 15 18 19 25 23 17 21 21 17 12 11 13 12 19 20 23 19 25 20 27 28 29 29 34 28 26 24 24 15 Columns 31 through 60 16 17 21 21 22 19 19 16 14 16 18 20 21 21 26 26 21 18 17 18 19 24 21 25 18 21 15 17 10 8 Columns 61 through 62 2 2

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

s = Columns 1 through 30 7 7 7 13 19 12 18 21 16 15 20 22 27 27 29 28 28 28 28 26 24 16 17 18 13 20 26 19 25 27 Columns 31 through 60 27 23 26 22 20 20 19 21 18 23 17 22 19 21 22 26 28 33 32 31 33 25 19 23 18 9 10 8 5 8 Columns 61 through 72 8 12 14 11 13 17 20 25 25 20 16 8

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

s = 1 2 3 4 5 4 3 2 1