非递归深度搜索 bool hasPath(char* matrix, int rows, int cols, char* str) { stack<pair<pair<int, int>, int> > s; int next[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; //右下左上 int tx, ty, n, m; for(int i = 0; i < rows; i++) for(int j = 0; j < cols; j++) { vector<vector<int> &g...