Cody

# Problem 44467. Product of Each Column

Solution 1393406

Submitted on 25 Dec 2017 by shimon zusmanovsky
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
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'prod')),'Cannot use prod() function')

3   Pass
mat = ones(5); v_correct = ones(1, 5); assert(isequal(myProd(mat),v_correct))

m = 5 n = 5 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1 v = 1 1 1 1 1

4   Pass
mat = [ 1, 2, 3, 4; 5, 6, 7, 2; 2, 3, 4, 5]; v_correct = [10, 36, 84, 40]; assert(isequal(myProd(mat),prod(mat)))

m = 3 n = 4 v = 1 1 1 1 v = 1 1 1 1 v = 5 1 1 1 v = 10 1 1 1 v = 10 2 1 1 v = 10 12 1 1 v = 10 36 1 1 v = 10 36 3 1 v = 10 36 21 1 v = 10 36 84 1 v = 10 36 84 4 v = 10 36 84 8 v = 10 36 84 40

5   Pass
m = randi([5,15]); n = randi([5,15]); mat = randi(5, n, m); v_correct = prod(mat); assert(isequal(myProd(mat),prod(mat)))

m = 10 n = 13 v = 1 1 1 1 1 1 1 1 1 1 1 1 1 v = 1 1 1 1 1 1 1 1 1 1 1 1 1 v = 2 1 1 1 1 1 1 1 1 1 1 1 1 v = 8 1 1 1 1 1 1 1 1 1 1 1 1 v = 40 1 1 1 1 1 1 1 1 1 1 1 1 v = 200 1 1 1 1 1 1 1 1 1 1 1 1 v = 800 1 1 1 1 1 1 1 1 1 1 1 1 v = 800 1 1 1 1 1 1 1 1 1 1 1 1 v = 2400 1 1 1 1 1 1 1 1 1 1 1 1 v = 4800 1 1 1 1 1 1 1 1 1 1 1 1 v = 4800 1 1 1 1 1 1 1 1 1 1 1 1 v = 4800 1 1 1 1 1 1 1 1 1 1 1 1 v = 4800 3 1 1 1 1 1 1 1 1 1 1 1 v = 4800 3 1 1 1 1 1 1 1 1 1 1 1 v = 4800 6 1 1 1 1 1 1 1 1 1 1 1 v = 4800 24 1 1 1 1 1 1 1 1 1 1 1 v = 4800 48 1 1 1 1 1 1 1 1 1 1 1 v = 4800 192 1 1 1 1 1 1 1 1 1 1 1 v = 4800 192 1 1 1 1 1 1 1 1 1 1 1 v = 4800 768 1 1 1 1 1 1 1 1 1 1 1 v = 4800 768 1 1 1 1 1 1 1 1 1 1 1 v = 4800 768 3 1 1 1 1 1 1 1 1 1 1 v = 4800 768 12 1 1 1 1 1 1 1 1 1 1 v = 4800 768 48 1 1 1 1 1 1 1 1 1 1 v = 4800 768 48 1 1 1 1 1 1 1 1 1 1 v = 4800 768 144 1 1 1 1 1 1 1 1 1 1 v = 4800 768 576 1 1 1 1 1 1 1 1 1 1 v = 4800 768 1728 1 1 1 1 1 1 1 1 1 1 v = 4800 768 1728 1 1 1 1 1 1 1 1 1 1 v = 4800 768 8640 1 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 1 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 1 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 1 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 3 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 12 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 12 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 48 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 240 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 240 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 1200 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 1 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 3 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 6 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 6 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 30 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 120 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 480 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 1440 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 1 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 4 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 20 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 100 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 200 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 800 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 3200 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 6400 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 6400 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 12800 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 38400 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 38400 1 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 38400 3 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 38400 12 1 1 1 1 1 1 v = 4800 768 34560 4800 5760 38400 24 ...