Cody

# Problem 42797. Find the path through the cell

Solution 1961254

Submitted on 6 Oct 2019 by Augusto Mazzei
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))

next = 2 next = 3 next = 4 next = 5 ans = logical 1

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

next = 2 next = 3 next = 4 next = 5 next = 6 next = 7 next = 8 next = 9 next = 10 next = [] ans = logical 0

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

next = 1 next = 2 next = 3 next = 4 next = 5 next = 6 ans = logical 1

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

next = 4 next = 5 next = 6 ans = logical 1

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

next = [] ans = logical 0

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

next = 2 next = 3 next = 4 next = 5 ans = logical 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))

next = 2 next = 4 next = 5 next = 6 next = 40 next = 41 next = 42 ans = logical 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))

next = 2 next = 4 next = 5 next = 6 next = 40 next = 41 next = 1×0 empty double row vector ans = logical 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))

next = 2 next = 4 next = 5 next = 6 next = 40 next = 41 next = 1×0 empty double row vector ans = logical 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))

next = 2 next = 4 next = 5 next = 6 next = 40 next = 41 next = 42 ans = logical 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))

next = 2 next = 4 next = 5 next = 6 next = 40 next = 41 next = 42 next = 53 next = 54 next = 55 ans = logical 1