Cody

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

Solution 2653367

Submitted on 5 Jul 2020 by Ramesh Kumar V
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))

m = 3 n = 3 z = 6 4 1 x = 6 2 4 4 0 3 1 1 5 z = 2 1 0 x = 6 2 4 4 1 3 1 0 5 z = 5 4 3 x = 6 2 5 4 1 4 1 0 3 y = 6 2 5 y = 6 2 5 4 1 4

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

m = 3 n = 3 z = 1 1 1 x = 1 1 1 1 1 1 1 1 1 z = 1 1 1 x = 1 1 1 1 1 1 1 1 1 z = 1 1 1 x = 1 1 1 1 1 1 1 1 1 y = 1 1 1 y = 1 1 1 1 1 1

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

m = 4 n = 4 z = 1 0 0 0 x = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 z = 1 0 0 0 x = 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 z = 1 0 0 0 x = 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 z = 1 0 0 0 x = 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 y = 1 1 1 1 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))

m = 5 n = 5 z = 21 16 11 6 1 x = 21 2 3 4 5 16 7 8 9 10 11 12 13 14 15 6 17 18 19 20 1 22 23 24 25 z = 22 17 12 7 2 x = 21 22 3 4 5 16 17 8 9 10 11 12 13 14 15 6 7 18 19 20 1 2 23 24 25 z = 23 18 13 8 3 x = 21 22 23 4 5 16 17 18 9 10 11 12 13 14 15 6 7 8 19 20 1 2 3 24 25 z = 24 19 14 9 4 x = 21 22 23 24 5 16 17 18 19 10 11 12 13 14 15 6 7 8 9 20 1 2 3 4 25 z = 25 20 15 10 5 x = 21 22 23 24 25 16 17 18 19 20 11 12 13 14 15 6 7 8 9 10 1 2 3 4 5 y = 21 22 23 24 25 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))

m = 3 n = 7 z = 7 6 1 x = 7 5 7 3 47 2 3 6 7 1 5 23 1 47 1 1 3 2 68 4 11 z = 7 5 1 x = 7 7 7 3 47 2 3 6 5 1 5 23 1 47 1 1 3 2 68 4 11 z = 7 3 1 x = 7 7 7 3 47 2 3 6 5 3 5 23 1 47 1 1 1 2 68 4 11 z = 5 3 2 x = 7 7 7 5 47 2 3 6 5 3 3 23 1 47 1 1 1 2 68 4 11 z = 68 47 23 x = 7 7 7 5 68 2 3 6 5 3 3 47 1 47 1 1 1 2 23 4 11 z = 4 2 1 x = 7 7 7 5 68 4 3 6 5 3 3 47 2 47 1 1 1 2 23 1 11 z = 47 11 3 x = 7 7 7 5 68 4 47 6 5 3 3 47 2 11 1 1 1 2 23 1 3 y = 7 7 7 5 68 4 47 y = 7 7 7 5 68 4 47 6 5 3 3 47 2 11