This solution is outdated. To rescore this solution, sign in.
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
x =
1
y =
2
c =
1
d =
1
tf =
1
x =
1
y =
1
c =
1
d =
3
tf =
0

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
x =
1
y =
2
c =
1
d =
3
tf =
1
x =
1
y =
3
c =
2
d =
3
tf =
1
x =
2
y =
3
c =
2
d =
2
tf =
1
x =
2
y =
2
c =
2
d =
1
tf =
1
x =
2
y =
1
c =
1
d =
1
tf =
1

3  Pass 
%%
a = [ 1 2
3 4 ]
tf_correct = false;
assert(isequal(isItSnaky(a),tf_correct))
a =
1 2
3 4
x =
1
y =
1
c =
1
d =
2
tf =
1
x =
1
y =
2
c =
2
d =
1
tf =
0

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
x =
2
y =
2
c =
2
d =
3
tf =
1
x =
2
y =
3
c =
3
d =
3
tf =
1
x =
3
y =
3
c =
3
d =
2
tf =
1
x =
3
y =
2
c =
3
d =
1
tf =
1
x =
3
y =
1
c =
2
d =
1
tf =
1
x =
2
y =
1
c =
1
d =
1
tf =
1
x =
1
y =
1
c =
1
d =
2
tf =
1
x =
1
y =
2
c =
1
d =
3
tf =
1
x =
1
y =
3
c =
1
d =
4
tf =
1
x =
1
y =
4
c =
2
d =
4
tf =
1
x =
2
y =
4
c =
3
d =
4
tf =
1
x =
3
y =
4
c =
4
d =
4
tf =
1
x =
4
y =
4
c =
4
d =
3
tf =
1
x =
4
y =
3
c =
4
d =
2
tf =
1
x =
4
y =
2
c =
4
d =
1
tf =
1

5  Pass 
%%
a = [ 1 2 3 2 1 ]
tf_correct = false;
assert(isequal(isItSnaky(a),tf_correct))
a =
1 2 3 2 1
x =
1 1
y =
1 5
c =
1 1
d =
2 4
tf =
0

6  Pass 
%%
a = [ 6 5 4 3 ]
tf_correct = false;
assert(isequal(isItSnaky(a),tf_correct))
a =
6 5 4 3
x =
Empty matrix: 1by0
y =
Empty matrix: 1by0
c =
Empty matrix: 1by0
d =
Empty matrix: 1by0
tf =
0

Extract leading nonzero digit
1300 Solvers
234 Solvers
2091 Solvers
Sum of odd numbers in a matrix
325 Solvers
556 Solvers