Cody

Problem 2172. Delete the rows in the middle

Solution 3328918

Submitted on 22 Oct 2020 by Nikolaos Nikolaou
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))

y = 1 2 1 5

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

y = 1 5 1 2 y = 1 5 1 2 3 40 3 36

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

y = 1 5 1 2 y = 1 5 1 2 3 40 3 55 y = 1 5 1 2 3 40 3 55 5 4 5 1

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

y = 1 5 1 2 y = 1 5 1 2 3 40 3 68 y = 1 5 1 2 3 40 3 68 4 20 4 23

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

y = 1 5 1 2 y = 1 5 1 2 3 40 3 68 y = 1 5 1 2 3 40 3 68 4 20 4 23 y = 1 5 1 2 3 40 3 68 4 20 4 23 5 4 5 7

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

y = 99 100 99 102

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

y = 99 100 99 102 y = 99 100 99 102 95 10 95 13 y = 99 100 99 102 95 10 95 13 86 192 86 65

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

y = 99 100 99 102 y = 99 100 99 102 95 10 95 13 y = 99 100 99 102 95 10 95 13 86 192 86 65 y = 99 100 99 102 95 10 95 13 86 192 86 65 79 1 79 0

Suggested Problems

More from this Author67

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!