Cody

# Problem 42797. Find the path through the cell

Solution 868709

Submitted on 8 Apr 2016 by Atsushi Ueno
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 3 4 5}; y_correct=1; assert(isequal(through_list(x),y_correct))

x = [1] [2] [3] [4] [5] x = [1] [2] [3] [4] [5] x = [1] [2] [3] [4] [5] x = [1] [2] [3] [4] [5] x = [1] [2] [3] [4] [5] b = 1.0e+15 * -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

2   Pass
x = {1 2 3 4 5 6 7 8 9 10 9}; assert(isequal(through_list(x),0))

x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [9] x = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [NaN] b = 1.0e+15 * -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 NaN 1.0000 y = 0

3   Pass
x = {0 1 2 3 4 5 [5 5 5 6]}; assert(isequal(through_list(x),1))

x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [1x4 double] x = [0] [1] [2] [3] [4] [5] [6] b = 1.0e+15 * -0.0000 0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

4   Pass
x = {[1 2] 4 [4 5] 6}; assert(isequal(through_list(x),1))

x = [1] [4] [1x2 double] [6] x = [1] [4] [1x2 double] [6] x = [1] [4] [5] [6] x = [1] [4] [5] [6] b = 1.0e+15 * -0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

5   Pass
assert(isequal(through_list({[1 2] 0 [4 5] 6} ),0))

x = [1] [0] [1x2 double] [6] x = [1] [NaN] [1x2 double] [6] x = [1] [NaN] [4] [6] x = [1] [NaN] [4] [6] b = 1.0e+15 * -0.0000 0.0000 NaN 0.0000 0.0000 1.0000 y = 0

6   Pass
x = {[-2 -2 0 1] 2 3 4 5}; assert(isequal(through_list(x),1))

x = [-2] [2] [3] [4] [5] x = [-2] [2] [3] [4] [5] x = [-2] [2] [3] [4] [5] x = [-2] [2] [3] [4] [5] x = [-2] [2] [3] [4] [5] b = 1.0e+15 * -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

7   Pass
{[10 1] [2 3] [4 40] [1 1 2 2 2 5] 6 40 [1:41] [1:42]}; assert(isequal(through_list(ans),1))

x = [1] [1x2 double] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [4] [1x6 double] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x42 double] x = [1] [2] [4] [5] [6] [40] [41] [1x42 double] x = [1] [2] [4] [5] [6] [40] [41] [42] b = 1.0e+15 * -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

8   Pass
{[10 1] [2 3] [4 40] [1 1 2 2 2 5] 6 40 [1:41] [1:12]}; assert(isequal(through_list(ans),0))

x = [1] [1x2 double] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [4] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [1] [2] [4] [5] [6] [40] [41] [1x12 double] x = [1] [2] [4] [5] [6] [40] [41] [NaN] b = 1.0e+15 * -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 NaN 1.0000 y = 0

9   Pass
{[-10:1:10] [2 3] [4 40] [1 1 2 2 2 5] 6 40 [1:41] [1:12]}; assert(isequal(through_list(ans),0))

x = [-10] [1x2 double] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [1x2 double] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [4] [1x6 double] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [4] [5] [6] [40] [1x41 double] [1x12 double] x = [-10] [2] [4] [5] [6] [40] [41] [1x12 double] x = [-10] [2] [4] [5] [6] [40] [41] [NaN] b = 1.0e+15 * -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 NaN 1.0000 y = 0

10   Pass
assert(isequal(through_list({[-10:1:10] [2 3] [4 40] [1 1 2 2 2 5 100 1000 -100] 6 [5 40 200 210] [1:41] [10:52]}),1))

x = [-10] [1x2 double] [1x2 double] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] x = [-10] [2] [1x2 double] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] x = [-10] [2] [4] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] x = [-10] [2] [4] [5] [6] [1x4 double] [1x41 double] [1x43 double] x = [-10] [2] [4] [5] [6] [1x4 double] [1x41 double] [1x43 double] x = [-10] [2] [4] [5] [6] [40] [1x41 double] [1x43 double] x = [-10] [2] [4] [5] [6] [40] [41] [1x43 double] x = [-10] [2] [4] [5] [6] [40] [41] [42] b = 1.0e+15 * -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1

11   Pass
assert(isequal(through_list({[-10:1:10] [2 3] [4 40] [1 1 2 2 2 5 100 1000 -100] 6 [5 40 200 210] [1:41] [10:52] 53 [1001 54] [1 2 3 4 5 55]}),1))

x = [-10] [1x2 double] [1x2 double] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [1x2 double] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [1x9 double] [6] [1x4 double] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [1x4 double] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [1x4 double] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [1x41 double] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [41] [1x43 double] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [41] [42] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [41] [42] [53] [1x2 double] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [41] [42] [53] [54] [1x6 double] x = [-10] [2] [4] [5] [6] [40] [41] [42] [53] [54] [55] b = 1.0e+15 * -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 y = 1