经典老题了,直接记忆化搜索即可。 class Solution { public: int dir[4][2] = {{-1,0},{0,1},{1,0},{0,-1}}; int n, m, res = 0; vector<vector<int>> f; int solve(vector<vector<int> >& matrix) { // write code here n = matrix.size(), m = matrix[0].size(); f...