C++ || DFS
Approach\nAPPLE DFS\n\n# Complexity\n- Time complexity:\nO(m*n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    void solve(int i,int j,
# Approach\nAPPLE DFS\n\n# Complexity\n- Time complexity:\nO(m*n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    void solve(int i,int j,int &m,int &n,vector<vector<int>> &g,int &k){\n        if(i<0||j<0||i>=m||j>=n||g[i][j]==0)return;\n        k += g[i][j];\n        g[i][j]  = 0;\n        solve(i+1,j,m,n,g,k);\n        solve(i,j+1,m,n,g,k);\n        solve(i-1,j,m,n,g,k);\n        solve(i,j-1,m,n,g,k);\n    }\n    int findMaxFish(vector<vector<int>>& grid) {\n        int ans = 0;\n        int i,j,m=grid.size(),n=grid[0].size(),k;\n        for(i = 0; i < m; i++){\n            for(j = 0; j < n; j++){\n                if(grid[i][j]){\n                    k = 0;\n                    solve(i,j,m,n,grid,k);\n                    cout<<k<<" ";\n                    ans = max(ans,k);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['Depth-First Search', 'C++']