Cody

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

Solution 2008961

Submitted on 8 Nov 2019 by Weiyang Zhang
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_prod = 120 temp_prod = 480 temp_prod = 720 i = 3

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

temp_prod = 9072 temp_prod = 31104 i = 28

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

temp_prod = 180 temp_prod = 360 temp_prod = 540 temp_prod = 2700 temp_prod = 3600 temp_prod = 5400 temp_prod = 7560 temp_prod = 22680 temp_prod = 59049 i = 47

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

temp_prod = 1008 temp_prod = 1080 temp_prod = 3840 temp_prod = 4800 temp_prod = 5760 temp_prod = 12960 i = 21

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

temp_prod = 450 temp_prod = 600 temp_prod = 1600 temp_prod = 2240 temp_prod = 3024 temp_prod = 4032 temp_prod = 9072 i = 44

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

temp_prod = 1 i = 1