Cody

Solution 2246166

Submitted on 30 Apr 2020 by Yuan
  • Size: 22
  • This is the leading solution.
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
a = 1; b=2; c_correct = 2; assert(isequal(ThreeDimMatrix2(a,b),c_correct)) a =ones(2,2); b=zeros(2,2); c_correct=[1;2;3;4]; assert(isequal(ThreeDimMatrix2(a,b),c_correct)) a=[1 2 3;4 5 6;7 8 9]; b=magic(3); c_correct=[9;15]; assert(isequal(ThreeDimMatrix2(a,b),c_correct)) a=[-3 0 -1 1;-6 -5 7 8;-4 0 0 1;3 4 5 6]; b=magic(4); c_correct=17; assert(isequal(ThreeDimMatrix2(a,b),c_correct))

ans = 1 2 ans = 2 ans = 1 1 0 0 1 1 0 0 ans = 1 2 3 4 ans = 1 2 3 8 1 6 4 5 6 3 5 7 7 8 9 4 9 2 ans = 9 15 ans = -3 0 -1 1 16 2 3 13 -6 -5 7 8 5 11 10 8 -4 0 0 1 9 7 6 12 3 4 5 6 4 14 15 1 ans = 17