Cody

Solution 1986100

Submitted on 22 Oct 2019
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   Fail
x = magic(4); y_correct = sum(diag(x)); assert(isequal(your_fcn_name(x),y_correct))

a = 4 m = 34 34 34 34 x = 0 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 n = 18 34 34 34 y = 16 0 0 0 m = 18 34 34 34 x = 0 2 3 13 5 0 10 8 9 7 6 12 4 14 15 1 n = 18 23 34 34 y = 0 11 0 0 m = 18 23 34 34 x = 0 2 3 13 5 0 10 8 9 7 0 12 4 14 15 1 n = 18 23 28 34 y = 0 0 6 0 m = 18 23 28 34 x = 0 2 3 13 5 0 10 8 9 7 0 12 4 14 15 0 n = 18 23 28 33 y = 0 0 0 1

Assertion failed.

2   Fail
x = ones(5); y_correct = sum(diag(x)); assert(isequal(your_fcn_name(x),y_correct))

a = 5 m = 5 5 5 5 5 x = 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 n = 4 5 5 5 5 y = 1 0 0 0 0 m = 4 5 5 5 5 x = 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 n = 4 4 5 5 5 y = 0 1 0 0 0 m = 4 4 5 5 5 x = 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 n = 4 4 4 5 5 y = 0 0 1 0 0 m = 4 4 4 5 5 x = 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 n = 4 4 4 4 5 y = 0 0 0 1 0 m = 4 4 4 4 5 x = 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 n = 4 4 4 4 4 y = 0 0 0 0 1

Assertion failed.

Suggested Problems

More from this Author1