Cody

# Problem 42705. Is It a Snake?

Solution 1966960

Submitted on 8 Oct 2019 by Paul Morant
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
a = [ 2 1 3 4 ] tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

a = 2 1 3 4 B = 1 2 3 4 I = 2 1 3 4 r = 1 1 1 1 c = 2 1 3 4 D = 0 -1 0 2 0 1

2   Pass
a = [ 6 1 2 5 4 3 ] tf_correct = true; assert(isequal(isItSnaky(a),tf_correct))

a = 6 1 2 5 4 3 B = 1 2 3 4 5 6 I = 3 5 6 4 2 1 r = 1 1 2 2 2 1 c = 2 3 3 2 1 1 D = 0 1 1 0 0 -1 0 -1 -1 0

3   Pass
a = [ 1 2 3 4 ] tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

a = 1 2 3 4 B = 1 2 3 4 I = 1 3 2 4 r = 1 1 2 2 c = 1 2 1 2 D = 0 1 1 -1 0 1

4   Pass
a = [ 7 8 9 10 6 1 2 11 5 4 3 12 16 15 14 13 ] tf_correct = true; assert(isequal(isItSnaky(a),tf_correct))

a = 7 8 9 10 6 1 2 11 5 4 3 12 16 15 14 13 B = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 I = 6 10 11 7 3 2 1 5 9 13 14 15 16 12 8 4 r = 2 2 3 3 3 2 1 1 1 1 2 3 4 4 4 4 c = 2 3 3 2 1 1 1 2 3 4 4 4 4 3 2 1 D = 0 1 1 0 0 -1 0 -1 -1 0 -1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 -1 0 -1 0 -1

5   Pass
a = [ 1 2 3 2 1 ] tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

a = 1 2 3 2 1 B = 1 1 2 2 3 I = 1 5 2 4 3 r = 1 1 1 1 1 c = 1 5 2 4 3 D = 0 4 0 -3 0 2 0 -1

6   Pass
a = [ 6 5 4 3 ] tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

a = 6 5 4 3 B = 3 4 5 6 I = 4 3 2 1 r = 1 1 1 1 c = 4 3 2 1 D = 0 -1 0 -1 0 -1

7   Pass
a = [ 1 2 3 4 5 6 7 8 9 ] tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

a = 1 2 3 4 5 6 7 8 9 B = 1 2 3 4 5 6 7 8 9 I = 1 4 7 2 5 8 3 6 9 r = 1 1 1 2 2 2 3 3 3 c = 1 2 3 1 2 3 1 2 3 D = 0 1 0 1 1 -2 0 1 0 1 1 -2 0 1 0 1

8   Pass
a = [ 2 1 1 1 ]; tf_correct = false; assert(isequal(isItSnaky(a),tf_correct))

B = 1 1 1 2 I = 2 3 4 1 r = 1 1 1 1 c = 2 3 4 1 D = 0 1 0 1 0 -3