C++|| Simple BFS Approach
\nclass Solution {\npublic:\n    int maxi=INT_MIN;\n    int dx[4]={0,1,0,-1};\n    int dy[4]={1,0,-1,0};\n    void f(int i,int j,int m,int n,vector<vector<int>>
```\nclass Solution {\npublic:\n    int maxi=INT_MIN;\n    int dx[4]={0,1,0,-1};\n    int dy[4]={1,0,-1,0};\n    void f(int i,int j,int m,int n,vector<vector<int>> &grid,vector<vector<int>> &vis)\n    {\n        queue<pair<int,int>> q;\n        q.push({i,j});\n        vis[i][j]=1;\n        int s=0;\n        while(!q.empty())\n        {\n            int x=q.front().first;\n            int y=q.front().second;\n            s+=grid[x][y];\n            q.pop();\n            for(int k=0;k<4;k++)\n            {\n                int newx=x+dx[k];\n                int newy=y+dy[k];\n                if(newx<0 or newy<0 or newx>=m or newy>=n or vis[newx][newy]==1 or grid[newx][newy]==0)\n                    continue;\n                q.push({newx,newy});\n                vis[newx][newy]=1;\n            }\n        }\n        maxi=max(maxi,s);\n    }\n    int findMaxFish(vector<vector<int>>& grid) {\n        int m=grid.size();\n        int n=grid[0].size();\n        vector<vector<int>> vis(m,vector<int>(n,0));\n        for(int i=0;i<m;i++)\n        {\n            for(int j=0;j<n;j++)\n            {\n                if(grid[i][j]>0 and !vis[i][j])\n                {\n                    f(i,j,m,n,grid,vis);\n                }\n            }\n        }\n        return (maxi==INT_MIN)?0:maxi;\n    }\n};\n```
[]