Cody

Solution 1482437

Submitted on 7 Apr 2018 by bainhome
  • Size: 13
  • 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
x = [ones(1,10) 2*ones(1,10)]; y_correct = [ones(1,10) zeros(1,10);zeros(1,10) ones(1,10)]; assert(isequal(sprs2matrix(x),y_correct));

2   Pass
x = 1:100; y_correct = eye(100); assert(isequal(sprs2matrix(x),y_correct));

3   Pass
x = [1 4 5 3 6]; y_correct = [1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1]; assert(isequal(sprs2matrix(x),y_correct));

4   Pass
x = 10; y_correct = zeros(x,1); y_correct (x)=1; assert(isequal(sprs2matrix(x),y_correct));