Cody

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

Solution 1558632

Submitted on 12 Jun 2018 by Jakub Mrowka
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))

temp = 15 temp = 18 temp = 19 temp = 18 temp = 15

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

temp = 24 temp = 26 temp = 22 temp = 29 temp = 33 temp = 28 temp = 26 temp = 31 temp = 24 temp = 23 temp = 19 temp = 21 temp = 20 temp = 19 temp = 22 temp = 26 temp = 19 temp = 17 temp = 18 temp = 20 temp = 22 temp = 24 temp = 18 temp = 24 temp = 25 temp = 28 temp = 34 temp = 40 temp = 34 temp = 33 temp = 24 temp = 19 temp = 17 temp = 23 temp = 17 temp = 22 temp = 22 temp = 22 temp = 16 temp = 15 temp = 11 temp = 15 temp = 11 temp = 15 temp = 21

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

temp = 20 temp = 21 temp = 23 temp = 27 temp = 25 temp = 21 temp = 27 temp = 30 temp = 32 temp = 38 temp = 36 temp = 30 temp = 24 temp = 25 temp = 20 temp = 23 temp = 23 temp = 26 temp = 22 temp = 21 temp = 18 temp = 24 temp = 21 temp = 19 temp = 23 temp = 29 temp = 26 temp = 23 temp = 23 temp = 24 temp = 23 temp = 22 temp = 23 temp = 30 temp = 29 temp = 22 temp = 24 temp = 32 temp = 26 temp = 28 temp = 36 temp = 33 temp = 33 temp = 39 temp = 39 temp = 39 temp = 45

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

temp = 25 temp = 23 temp = 17 temp = 21 temp = 21 temp = 17 temp = 12 temp = 11 temp = 13 temp = 12 temp = 19 temp = 20 temp = 23 temp = 19 temp = 25 temp = 20 temp = 27 temp = 28 temp = 29 temp = 29 temp = 34 temp = 28 temp = 26 temp = 24 temp = 24 temp = 15 temp = 16 temp = 17 temp = 21 temp = 21 temp = 22 temp = 19 temp = 19 temp = 16 temp = 14 temp = 16 temp = 18 temp = 20 temp = 21 temp = 21 temp = 26 temp = 26 temp = 21 temp = 18 temp = 17 temp = 18 temp = 19 temp = 24 temp = 21 temp = 25 temp = 18 temp = 21 temp = 15 temp = 17

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

temp = 19 temp = 12 temp = 18 temp = 21 temp = 16 temp = 15 temp = 20 temp = 22 temp = 27 temp = 27 temp = 29 temp = 28 temp = 28 temp = 28 temp = 28 temp = 26 temp = 24 temp = 16 temp = 17 temp = 18 temp = 13 temp = 20 temp = 26 temp = 19 temp = 25 temp = 27 temp = 27 temp = 23 temp = 26 temp = 22 temp = 20 temp = 20 temp = 19 temp = 21 temp = 18 temp = 23 temp = 17 temp = 22 temp = 19 temp = 21 temp = 22 temp = 26 temp = 28 temp = 33 temp = 32 temp = 31 temp = 33 temp = 25 temp = 19 temp = 23 temp = 18 temp = 9 temp = 10 temp = 8 temp = 5 temp = 8 temp = 8 temp = 12 temp = 14 temp = 11 temp = 13 temp = 17 temp = 20 temp = 25

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

temp = 5