Cody

Solution 1815340

Submitted on 14 May 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 = [2,12,8,5; 4,4,5,12; 3,10,8,3; 12,0,1,2]; y_correct1 = [1,2,4,3]; y_correct2 = [1,4,2,3]; test1 = isequal(Assignment(x),y_correct1); test2 = isequal(Assignment(x),y_correct2); assert(test1||test2)

y = 1 4 4 4 y = 1 4 4 4

Assertion failed.

2   Fail
x = [7,5,3,2,6; 6,3,6,6,5; 3,3,9,4,7; 4,5,3,3,4; 2,3,4,3,5]; y_correct = [5,3,4,1,2]; assert(isequal(Assignment(x),y_correct))

y = 5 2 1 1 4

Assertion failed.

3   Pass
x = eye(4); x(x==0) = 3; y_correct = 1:4; assert(isequal(Assignment(x),y_correct))

y = 1 2 3 4

4   Pass
x = 5 * ones(5); x(1,4) = 1; x(2,2) = 1; x(3,5) = 1; x(4,1) = 1; x(5,3) = 1; y_correct = [4,2,5,1,3]; assert(isequal(Assignment(x),y_correct))

y = 4 2 5 1 3

5   Pass
x = 1:4; x = [x; circshift(x,1); circshift(x,2); circshift(x,3)]; y_correct = 1:4; assert(isequal(Assignment(x),y_correct))

y = 1 2 3 4

6   Pass
x = [7,5,4; 14,16,2; 7,1,9]; y_correct = [1,3,2]; assert(isequal(Assignment(x),y_correct))

y = 1 3 2

Suggested Problems