Cody

Problem 2172. Delete the rows in the middle

Solution 1505539

Submitted on 26 Apr 2018 by Erik Luiten
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; 1 7; 1 8; 1 6; 1 5]; y_correct = [1 2; 1 5]; assert(isequal(delete_rows(x),y_correct))

2   Pass
x = [1 5;1 2;3 40;3 55;3 62;3 74;3 36]; y_correct = [1 5;1 2;3 40;3 36]; assert(isequal(delete_rows(x),y_correct))

3   Pass
x = [1 5;1 2;3 40;3 55;5 4;5 3;5 9;5 7;5 2;5 1]; y_correct = [1 5;1 2;3 40;3 55;5 4;5 1]; assert(isequal(delete_rows(x),y_correct))

4   Pass
x = [1 5;1 4;1 2;3 40;3 43;3 55;3 68;4 20;4 19;4 14;4 22;4 23]; y_correct = [1 5;1 2;3 40;3 68;4 20;4 23]; assert(isequal(delete_rows(x),y_correct))

5   Pass
x = [1 5;1 4;1 2;3 40;3 43;3 55;3 68;4 20;4 19;4 14;4 22;4 23;5 4;5 7]; y_correct = [1 5;1 2;3 40;3 68;4 20;4 23;5 4; 5 7]; assert(isequal(delete_rows(x),y_correct))

6   Pass
x = [99 100; 99 105; 99 102]; y_correct = [99 100; 99 102]; assert(isequal(delete_rows(x),y_correct))

7   Pass
x = [99 100;99 105;99 102;95 10;95 15;95 13;86 192;86 187;86 65]; y_correct = [99 100;99 102;95 10;95 13;86 192;86 65]; assert(isequal(delete_rows(x),y_correct))

8   Pass
x = [99 100;99 105;99 102;95 10;95 15;95 13;86 192;86 187;86 65;79 1;79 2;79 0;79 4;79 5;79 0]; y_correct = [99 100;99 102;95 10;95 13;86 192;86 65;79 1;79 0;]; assert(isequal(delete_rows(x),y_correct))