Cody

# Problem 44467. Product of Each Column

Solution 2068112

Submitted on 24 Dec 2019 by ariel afriat
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))

p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 1 p = 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)))

p = 1 p = 1 p = 5 p = 10 p = 1 p = 2 p = 12 p = 36 p = 1 p = 3 p = 21 p = 84 p = 1 p = 4 p = 8 p = 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)))

p = 1 p = 3 p = 6 p = 30 p = 120 p = 240 p = 720 p = 1440 p = 7200 p = 21600 p = 64800 p = 1 p = 3 p = 6 p = 30 p = 90 p = 270 p = 270 p = 1080 p = 5400 p = 5400 p = 5400 p = 1 p = 1 p = 3 p = 9 p = 18 p = 54 p = 54 p = 270 p = 810 p = 1620 p = 6480 p = 1 p = 4 p = 8 p = 8 p = 24 p = 72 p = 72 p = 360 p = 1800 p = 1800 p = 7200 p = 1 p = 1 p = 3 p = 6 p = 18 p = 54 p = 270 p = 810 p = 1620 p = 6480 p = 19440 p = 1 p = 1 p = 4 p = 8 p = 8 p = 32 p = 160 p = 640 p = 3200 p = 12800 p = 12800 p = 1 p = 3 p = 15 p = 45 p = 180 p = 540 p = 1080 p = 3240 p = 3240 p = 3240 p = 6480 p = 1 p = 2 p = 6 p = 30 p = 30 p = 60 p = 300 p = 1500 p = 4500 p = 13500 p = 54000 p = 1 p = 4 p = 16 p = 16 p = 80 p = 400 p = 800 p = 1600 p = 8000 p = 16000 p = 32000 p = 1 p = 4 p = 4 p = 20 p = 80 p = 240 p = 960 p = 960 p = 2880 p = 5760 p = 23040