classSolution{ // There is only 8 possible way that a Knight can move within the chessboard. private (int,int)[] directions = [(-1,-2), (1,-2), (2,-1), (2,1), (1,2), (-1,2), (-2,1), (-2,-1)];publicintFindPossibleMoves(int[,] mat,int p,int q) {int n =mat.Length;int count =0;foreach ((int xP,int yP) in directions) { // move next stepint newX = p + xP;int newY = q + yP;if (newX >=0&& newX <= n && newY >=0&& newY <= n &&mat[newX , newY ] ==0) { count++; } }return count; }}