Cody

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

Solution 1919237

Submitted on 2 Sep 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   Pass
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))

s1 = 6 t = 1 NaN 4 s2 = 4 y = 6 4 s1 = 2 t = NaN 0 1 s2 = 1 y = 6 2 4 1 s1 = 5 t = 4 3 NaN s2 = 4 y = 6 2 5 4 1 4

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

s1 = 1 t = NaN NaN NaN s2 = NaN y = 1 NaN s1 = 1 t = NaN NaN NaN s2 = NaN y = 1 1 NaN NaN s1 = 1 t = NaN NaN NaN s2 = NaN y = 1 1 1 NaN NaN NaN

Assertion failed.

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

s1 = 1 t = NaN 0 0 0 s2 = 0 y = 1 0 s1 = 1 t = 0 NaN 0 0 s2 = 0 y = 1 1 0 0 s1 = 1 t = 0 0 NaN 0 s2 = 0 y = 1 1 1 0 0 0 s1 = 1 t = 0 0 0 NaN s2 = 0 y = 1 1 1 1 0 0 0 0

4   Pass
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))

s1 = 21 t = 1 6 11 16 NaN s2 = 16 y = 21 16 s1 = 22 t = 2 7 12 17 NaN s2 = 17 y = 21 22 16 17 s1 = 23 t = 3 8 13 18 NaN s2 = 18 y = 21 22 23 16 17 18 s1 = 24 t = 4 9 14 19 NaN s2 = 19 y = 21 22 23 24 16 17 18 19 s1 = 25 t = 5 10 15 20 NaN s2 = 20 y = 21 22 23 24 25 16 17 18 19 20

5   Pass
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))

s1 = 7 t = 1 6 NaN s2 = 6 y = 7 6 s1 = 7 t = 5 NaN 1 s2 = 5 y = 7 7 6 5 s1 = 7 t = NaN 1 3 s2 = 3 y = 7 7 7 6 5 3 s1 = 5 t = 3 NaN 2 s2 = 3 y = 7 7 7 5 6 5 3 3 s1 = 68 t = 47 23 NaN s2 = 47 y = 7 7 7 5 68 6 5 3 3 47 s1 = 4 t = 2 1 NaN s2 = 2 y = 7 7 7 5 68 4 6 5 3 3 47 2 s1 = 47 t = 3 NaN 11 s2 = 11 y = 7 7 7 5 68 4 47 6 5 3 3 47 2 11