Cody

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

Solution 802626

Submitted on 7 Jan 2016 by David Schafer
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))

this = 120 that = 120 this = 480 that = 480 this = 720 that = 720 this = 480 this = 120

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

this = 0 this = 0 this = 0 this = 0 this = 9072 that = 9072 this = 4032 this = 2880 this = 6480 this = 1440 this = 1080 this = 0 this = 0 this = 0 this = 0 this = 0 this = 1344 this = 0 this = 0 this = 0 this = 0 this = 0 this = 1152 this = 0 this = 0 this = 0 this = 0 this = 0 this = 31104 that = 31104 this = 7776 this = 6912 this = 0 this = 0 this = 0 this = 0 this = 0 this = 960 this = 960 this = 960 this = 240 this = 120 this = 24 this = 56 this = 0 this = 0 this = 0

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

this = 180 that = 180 this = 360 that = 360 this = 540 that = 540 this = 2700 that = 2700 this = 1620 this = 900 this = 3600 that = 3600 this = 5400 that = 5400 this = 7560 that = 7560 this = 22680 that = 22680 this = 13608 this = 3402 this = 1134 this = 1296 this = 576 this = 1152 this = 1152 this = 2304 this = 1152 this = 864 this = 432 this = 1728 this = 864 this = 432 this = 1008 this = 3024 this = 1890 this = 0 this = 0 this = 0 this = 0 this = 0 this = 512 this = 2304 this = 2016 this = 252 this = 378 this = 3402 this = 1134 this = 1458 this = 13122 this = 6561 this = 6561 this = 19683 this = 19683 this = 19683 this = 59049 that = 59049

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

this = 1008 that = 1008 this = 720 this = 180 this = 420 this = 420 this = 140 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 1080 that = 1080 this = 480 this = 3840 that = 3840 this = 4800 that = 4800 this = 5760 that = 5760 this = 5760 this = 12960 that = 12960 this = 3240 this = 1944 this = 1296 this = 1296 this = 0 this = 0 this = 0 this = 0 this = 0 this = 576 this = 0 this = 0 this = 0 this = 0 this = 0 this = 480 this = 720 this = 864 this = 864 this = 2304 this = 2304 this = 384 this = 192 this = 144 this = 162 this = 243 this = 1458 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0

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

this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 450 that = 450 this = 600 that = 600 this = 1600 that = 1600 this = 1600 this = 2240 that = 2240 this = 1792 this = 1792 this = 1792 this = 1792 this = 1280 this = 640 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 1728 this = 1728 this = 576 this = 1440 this = 720 this = 0 this = 0 this = 0 this = 0 this = 0 this = 315 this = 105 this = 630 this = 360 this = 1080 this = 1296 this = 3024 that = 3024 this = 4032 that = 4032 this = 9072 that = 9072 this = 6048 this = 5040 this = 6480 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0 this = 0

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

this = 1 that = 1