Return the least number of moves required to reach the square n^2 on a snakes and ladders board. If it is not possible, return -1.
{
"board": [
[
-1,
-1,
-1,
-1,
-1,
-1
],
[
-1,
-1,
-1,
-1,
-1,
-1
],
[
-1,
-1,
-1,
-1,
-1,
-1
],
[
-1,
35,
-1,
-1,
13,
-1
],
[
-1,
-1,
-1,
-1,
-1,
-1
],
[
-1,
15,
-1,
-1,
-1,
-1
]
]
}4{
"board": [
[
-1,
-1
],
[
-1,
3
]
]
}1{
"board": [
[
-1,
-1,
-1
],
[
-1,
9,
8
],
[
-1,
8,
9
]
]
}1Sign in to Run Code and Submit