Cody

# Problem 11. Back and Forth Rows

Solution 1845673

Submitted on 11 Jun 2019 by Chinmay Anand
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)));

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

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

p = 0 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 p = 1 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 p = 2 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 p = 3 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 p = 4 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 p = 5 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 p = 6 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 p = 7 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 p = 8 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 p = 9 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 p = 10 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 p = 11 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 p = 12 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 p = 13 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 p = 14 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 p = 15 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 p = 16 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 p = 17 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 p = 18 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 p = 19 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 p = 20 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 p = 21 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 p = 22 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 p = 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 24 1 p = 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 25 p = 25