I couldn't come up an efficient solution for the problem, as there were no editorials available for it I had a look at other submitted solutions, but couldn't understand the approach. It would be cool if some one can give me an analysis for the same. asked 21 Dec '17, 21:21

A turtle can move only down or right. The start and end positions are fixed. This means every valid walk from start to finish is of the same length. Given height h of the board and width w, the turtle has to move downwards (h  1) times and to the right (w  1) times. So every valid walk is (h  1) + (w  1) steps long and consists of (h  1) + (w  1) + 1 tiles. As both players play perfectly and the starting board always has a valid path from start to finish, there's always a valid path on the board as long as there are at least (h  1) + (w  1) + 1 walkable tiles. Now just count the number of walkable tiles and substract (h  1) + (w  1) + 1 and you get the number of turns players can take until there are only (h  1) + (w  1) + 1 tiles on the board left. When this player takes one more tile away, there can't be a valid path from start to finish and this player loses the game. So the solution is to check whether the difference of walkable tiles on the board and path length from start to finish is divisible by 2. answered 21 Dec '17, 22:12
