Cody

Problem 308. Matrix with different incremental runs

Solution 1605058

Submitted on 9 Aug 2018
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
a = [3 2 4]; y_correct = [1 1 1;2 2 2;3 0 3;0 0 4]; assert(isequal(matInc(a),y_correct))

Undefined function or variable 'x'. Error in matInc (line 2) b = ndgrid(1:max(x),1:length(x)); Error in Test1 (line 3) assert(isequal(matInc(a),y_correct))

2   Fail
a = [0 1 1 2 0 3]; y_correct = [0 1 1 1 0 1;0 0 0 2 0 2;0 0 0 0 0 3]; assert(isequal(matInc(a),y_correct))

Undefined function or variable 'x'. Error in matInc (line 2) b = ndgrid(1:max(x),1:length(x)); Error in Test2 (line 3) assert(isequal(matInc(a),y_correct))