Easy Peasy DFS
\nclass Solution {\n    \n    private int solve(int i, int j, int m, int n, int[][] grid, boolean[][] vis){\n       // return if wrong position\n\t   if(i < 0 |
```\nclass Solution {\n    \n    private int solve(int i, int j, int m, int n, int[][] grid, boolean[][] vis){\n       // return if wrong position\n\t   if(i < 0 || j < 0 || i == m || j == n || vis[i][j] || grid[i][j] == 0){\n            return 0;\n        }\n\t\t\n\t\t// mark visited\n        vis[i][j] = true;\n\t\t\n        // call 4 directions\n        int total = grid[i][j];\n        total += solve(i+1, j, m, n, grid, vis);\n        total += solve(i, j+1, m, n, grid, vis);\n        total += solve(i, j-1, m, n, grid, vis);\n        total += solve(i-1, j, m, n, grid, vis);\n        return total;\n    }    \n\t\n    public int findMaxFish(int[][] grid) {\n        int m = grid.length;\n        int n = grid[0].length;\n        int max = 0;\n        boolean[][] vis = new boolean[m][n];\n\t\t\n        for(int i = 0; i < m; i++){\n            for(int j = 0; j < n; j++){\n                if(!vis[i][j] && grid[i][j] > 0){\n                    max = Math.max(max, solve(i, j, m, n, grid, vis));\n                }\n            }\n        }\n        \n        return max;\n    }\n}\n```\n\n![image](https://assets.leetcode.com/users/images/60965b38-0d54-43b0-bf48-49629fbf0e73_1682785742.352511.png)\n
['Java']