simple java bfs
\nclass pair{\n    int x;int y;\n    pair(int x1,int y1){\n        x=x1;\n        y=y1;\n    }\n}\nclass Solution {\n    public int findMaxFish(int[][] grid) {\
```\nclass pair{\n    int x;int y;\n    pair(int x1,int y1){\n        x=x1;\n        y=y1;\n    }\n}\nclass Solution {\n    public int findMaxFish(int[][] grid) {\n        int m=grid.length;\n        int n=grid[0].length;\n        int max=0;\n      //  System.out.print(bfs(0,1,grid,m,n)+" ");\n        for(int i=0;i<m;i++){\n            for(int j=0;j<n;j++){\n                if(grid[i][j]>0){\n                 //   System.out.print(bfs(i,j,grid,m,n)+" ");\n                    \n                    max=Math.max(max,bfs(i,j,grid,m,n));\n                }\n            }\n        }\n        return max;\n       \n    }\n    public int bfs(int i,int j,int grid[][],int m,int n){\n        Queue<pair> q=new LinkedList<>();\n        q.add(new pair(i,j));\n         int dx[]={-1,1,0,0};\n        int dy[]={0,0,-1,1};\n      //  int max=0;\n        int sum=grid[i][j];\n        grid[i][j]=0;\n        while(!q.isEmpty()){\n            pair it=q.poll();\n            int x=it.x;\n            int y=it.y;\n          //  System.out.print(x+" "+y);\n            for(int p=0;p<4;p++){\n                int newx=x+dx[p];\n                int newy=y+dy[p];\n                if(newx<0 || newy<0 || newx>=m || newy>=n || grid[newx][newy]==0)continue;\n                q.add(new pair(newx,newy));\n               \n                sum+=grid[newx][newy];\n                 grid[newx][newy]=0;\n            }\n        }\n        return sum;\n    }\n}\n```
['Breadth-First Search']