public static boolean hasPath(char[] matrix, int rows, int cols, char[] str){ for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { //row*cols+col表示在矩阵中的位置 //每次都需要重置isVisited boolean[] isVisited = new boolean[rows*cols+cols]; ...