Cody

# Problem 1923. Find the maximum two numbers of every column of a matrix

Solution 1998776

Submitted on 1 Nov 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 = [1 2 4; 6 0 3; 4 1 5]; y_correct = [6 2 5; 4 1 4]; assert(isequal(your_fcn_name(x),y_correct))

a = 6 b = logical 1 y = 6 1 a = 2 b = logical 1

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in your_fcn_name (line 6) y=[y,a;b] Error in Test1 (line 6) assert(isequal(your_fcn_name(x),y_correct))

2   Fail
x = ones(3); y_correct = ones(2,3); assert(isequal(your_fcn_name(x),y_correct))

a = 1 b = logical 0 y = 1 0 a = 1 b = logical 0

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in your_fcn_name (line 6) y=[y,a;b] Error in Test2 (line 3) assert(isequal(your_fcn_name(x),y_correct))

3   Fail
x = eye(4); y_correct = [ones(1,4); zeros(1,4)]; assert(isequal(your_fcn_name(x),y_correct))

a = 1 b = logical 1 y = 1 1 a = 1 b = logical 1

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in your_fcn_name (line 6) y=[y,a;b] Error in Test3 (line 3) assert(isequal(your_fcn_name(x),y_correct))

4   Fail
x = [1:5; 6:10; 11:15; 16:20; 21:25]; y_correct = [21:25; 16:20]; assert(isequal(your_fcn_name(x),y_correct))

a = 21 b = logical 1 y = 21 1 a = 22 b = logical 1

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in your_fcn_name (line 6) y=[y,a;b] Error in Test4 (line 7) assert(isequal(your_fcn_name(x),y_correct))

5   Fail
x = [1 5 7 3 47 2 3; 6 7 1 5 23 1 47; 7 1 3 2 68 4 11]; y_correct = [7 7 7 5 68 4 47; 6 5 3 3 47 2 11]; assert(isequal(your_fcn_name(x),y_correct))

a = 7 b = logical 1 y = 7 1 a = 7 b = logical 1

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in your_fcn_name (line 6) y=[y,a;b] Error in Test5 (line 6) assert(isequal(your_fcn_name(x),y_correct))