Cody

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

Solution 1920107

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 = 15 18 19 18 15 i = 3

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

s = 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 34 40 34 33 24 19 17 23 17 22 22 22 16 15 11 15 11 15 21 i = 28

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

s = 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 26 23 23 24 23 22 23 30 29 22 24 32 26 28 36 33 33 39 39 39 45 i = 47

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

s = 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 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 i = 21

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

s = 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 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 8 12 14 11 13 17 20 25 i = 44

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

s = 5 i = 1

### Community Treasure Hunt

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

Start Hunting!