test case 2 is coming wrong…please check code…code is in above link
Snakes and ladder board problem
Your code is not printing -1, instead its printing 0.
And in line no 10 when you assign -1 to whole array. That is not correct way, it just initialises the 0th index as -1 and rest as 0.
Test Case -:
10
2
5 66
9 88
1
67 8
1
3 90
7
99 10
97 20
98 30
96 40
95 50
94 60
93 70
2
5 66
9 88
1
67 8
1
3 90
7
99 10
97 20
98 30
96 40
95 50
94 60
93 70
2
5 66
9 88
1
67 8
1
3 90
7
99 10
97 20
98 30
96 40
95 50
94 60
93 70
2
5 66
9 88
1
67 8
1
3 90
7
99 10
97 20
98 30
96 40
95 50
94 60
93 70
2
5 66
9 88
1
67 8
1
3 90
7
99 10
97 20
98 30
96 40
95 50
94 60
93 70
Output should be -:
4
-1
4
-1
4
-1
4
-1
4
-1