Cody

# Problem 11. Back and Forth Rows

Solution 2013128

Submitted on 11 Nov 2019 by Braden Baird
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
n = 4; a = [ 1 2 3 4; 8 7 6 5; 9 10 11 12; 16 15 14 13]; assert(isequal(a,back_and_forth(n)));

k = 1 b = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 2 b = 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 3 b = 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 4 b = 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 k = 5 b = 1 2 3 4 1 1 1 5 1 1 1 1 1 1 1 1 k = 6 b = 1 2 3 4 1 1 6 5 1 1 1 1 1 1 1 1 k = 7 b = 1 2 3 4 1 7 6 5 1 1 1 1 1 1 1 1 k = 8 b = 1 2 3 4 8 7 6 5 1 1 1 1 1 1 1 1 k = 9 b = 1 2 3 4 8 7 6 5 9 1 1 1 1 1 1 1 k = 10 b = 1 2 3 4 8 7 6 5 9 10 1 1 1 1 1 1 k = 11 b = 1 2 3 4 8 7 6 5 9 10 11 1 1 1 1 1 k = 12 b = 1 2 3 4 8 7 6 5 9 10 11 12 1 1 1 1 k = 13 b = 1 2 3 4 8 7 6 5 9 10 11 12 1 1 1 13 k = 14 b = 1 2 3 4 8 7 6 5 9 10 11 12 1 1 14 13 k = 15 b = 1 2 3 4 8 7 6 5 9 10 11 12 1 15 14 13 k = 16 b = 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13 k = 17

2   Pass
n = 5; a = [ 1 2 3 4 5; 10 9 8 7 6; 11 12 13 14 15; 20 19 18 17 16; 21 22 23 24 25]; assert(isequal(a,back_and_forth(n)));

k = 1 b = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 2 b = 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 3 b = 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 4 b = 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 5 b = 1 2 3 4 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 6 b = 1 2 3 4 5 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 7 b = 1 2 3 4 5 1 1 1 7 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 8 b = 1 2 3 4 5 1 1 8 7 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 9 b = 1 2 3 4 5 1 9 8 7 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 10 b = 1 2 3 4 5 10 9 8 7 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 11 b = 1 2 3 4 5 10 9 8 7 6 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 12 b = 1 2 3 4 5 10 9 8 7 6 11 12 1 1 1 1 1 1 1 1 1 1 1 1 1 k = 13 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 1 1 1 1 1 1 1 1 1 1 1 1 k = 14 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 1 1 1 1 1 1 1 1 1 1 1 k = 15 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 1 1 1 1 1 1 1 1 1 1 k = 16 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 1 1 1 1 16 1 1 1 1 1 k = 17 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 1 1 1 17 16 1 1 1 1 1 k = 18 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 1 1 18 17 16 1 1 1 1 1 k = 19 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 1 19 18 17 16 1 1 1 1 1 k = 20 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 1 1 1 1 1 k = 21 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 1 1 1 1 k = 22 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 1 1 1 k = 23 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 23 1 1 k = 24 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 23 24 1 k = 25 b = 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 23 24 25 k = 26