Cody

# Problem 44467. Product of Each Column

Solution 2066371

Submitted on 22 Dec 2019 by lior dmitrichenko
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))

v = 1 1 1 1 1 c = 1 1 1 1 1 v = 1 1 1 1 1 c = 1 1 1 1 1 v = 1 1 1 1 1 c = 1 1 1 1 1 v = 1 1 1 1 1 c = 1 1 1 1 1 v = 1 1 1 1 1 c = 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)))

v = 1 1 1 1 c = 1 2 3 4 v = 1 2 3 4 c = 5 6 7 2 v = 5 12 21 8 c = 2 3 4 5 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)))

v = 1 1 1 1 1 c = 3 4 1 5 2 v = 3 4 1 5 2 c = 2 5 5 1 1 v = 6 20 5 5 2 c = 1 1 3 5 4 v = 6 20 15 25 8 c = 2 3 3 3 4 v = 12 60 45 75 32 c = 2 2 3 1 1 v = 24 120 135 75 32 c = 2 4 1 1 5 v = 48 480 135 75 160 c = 2 2 1 1 1 v = 96 960 135 75 160 c = 3 3 5 5 4 v = 288 2880 675 375 640