稍微优化了一下第一个代码,用‘1’表示访问过 class Solution { public: bool exist(vector<vector<char> > &board, string word) { int m = board.size(); int n = board[0].size(); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { ...