Cody

# Problem 2493. Must be in the front row...

Solution 2004917

Submitted on 6 Nov 2019 by Asif Newaz
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
matrix=magic(4); value=6; y_correct=[6 12 9 7; 15 1 4 14; 3 13 16 2; 10 8 5 11]; assert(isequal(front_row(matrix,value),y_correct))

m = 4 n = 4 x = 3 y = 3 y = 6 12 9 7 15 1 4 14 3 13 16 2 10 8 5 11

2   Pass
matrix=magic(5); value=3; matrix(3,2)=value; y_correct=[3 13 20 22 4; 12 19 21 3 10; 18 25 2 9 11; 24 1 8 15 17; 5 7 14 16 23]; assert(isequal(front_row(matrix,value),y_correct))

m = 5 n = 5 x = 3 4 y = 2 5 y = 3 13 20 22 4 12 19 21 3 10 18 25 2 9 11 24 1 8 15 17 5 7 14 16 23

3   Pass
matrix=magic(7); value=500; assert(isequal(front_row(matrix,value),matrix))

m = 7 n = 7 x = 0×1 empty double column vector y = 0×1 empty double column vector y = 30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20

### Community Treasure Hunt

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

Start Hunting!