linux系统的文件查找命令
时间: 2023-10-24 17:05:01 浏览: 100
&& matrix[i-1][j] == c && !visited[i-1][j]) {
list.add(new int[]{i-1, j});
}
if (i < matrix.length-1 && matrix[i+1][j] == c && !visited[i+1][j]) {
list.add(new int[]{i+1, j});
}
if (j > 0 && matrix[i][j-1] == c && !visited[i][j-1]) {
list.add(new int[]{i, j-1});
}
if (j < matrix[i].length-1 && matrix[i][j+1] == c && !visited[i][j+1]) {
list.add(new int[]{i, j+1});
}
return list;
}
The code is designed to solve a puzzle game where the goal is to find groups of adjacent cells with the same letter in a square matrix. The code reads in a matrix of characters from standard input, then recursively searches for groups of same characters using a depth-first search algorithm. It returns "perfect" if all cells in the matrix are visited and there are no groups of same characters, and "failure" otherwise.
However, there are some issues with the code. The for loops in the main method and the solve method are missing the increment statement, so they will result in an infinite loop. To fix this, the increment statement should be i++ and j++ respectively.
Additionally
阅读全文