i have written the code some testcases are being passed but some are giving wrong answer.
link for the code is :: https://ide.codingblocks.com/s/193737
Funky board Wrong answer
Hello @Debugger,
- There is mistake in canPlace() function:
you have written r<n twice instead of c<n
2.What is the relevance of board[i][j] -= 1;
Can you explain the logic?
i was converting the board[i][j] int 0 and -1 where -1 means blocked and 0 means we can can place knight there
Hey @Debugger,
Don’t you think that it will contradict with the statement:
return r>=0 && r<n && c>=0 && c<n && board[r][c];
If b[r][c]=0 means you can place the knight.
then for b[r][c]=0 the above statement will be false.
How would the function cannotMove() would account for the case when the horse is going out of the maze?