✅✅Beats 100%🔥C++🔥Python|| 🚀🚀Super Simple and Efficient Solution🚀🚀||🔥Python🔥C++✅✅
Complexity
Time complexity: O(mn)

Space complexity: O(mn)
⬆️👇⬆️UPVOTE it⬆️👇⬆️Code⬆️👇⬆️UPVOTE it⬆️👇⬆️
# Complexity
- Time complexity: $$O(mn)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(mn)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
⬆️👇⬆️UPVOTE it⬆️👇⬆️

# Code
```cpp []
class Solution {
 public:
  int findMaxFish(vector<vector<int>>& grid) {
    int ans = 0;
    for (int i = 0; i < grid.size(); ++i){
      for (int j = 0; j < grid[0].size(); ++j){
        if (grid[i][j] > 0)
          ans = max(ans, dfs(grid, i, j));
      }
    }
    return ans;
  }

 private:
  int dfs(vector<vector<int>>& grid, int i, int j) {
    if (i < 0 || i == grid.size() || j < 0 || j == grid[0].size())
      return 0;
    if (grid[i][j] == 0)
      return 0;
    int caughtFish = grid[i][j];
    grid[i][j] = 0;                                     
    return caughtFish +                                 
           dfs(grid, i + 1, j) + dfs(grid, i - 1, j) +  
           dfs(grid, i, j + 1) + dfs(grid, i, j - 1);
  }
};
```
```python3 []
class Solution:
  def findMaxFish(self, grid: list[list[int]]) -> int:
    def dfs(i: int, j: int) -> int:
      if i < 0 or i == len(grid) or j < 0 or j == len(grid[0]):
        return 0
      if grid[i][j] == 0:
        return 0
      caughtFish = grid[i][j]
      grid[i][j] = 0  
      return (caughtFish +
              dfs(i + 1, j) + dfs(i - 1, j) +
              dfs(i, j + 1) + dfs(i, j - 1))

    return max(dfs(i, j)
               for i in range(len(grid))
               for j in range(len(grid[0])))
```
⬆️👇⬆️UPVOTE it⬆️👇⬆️

['Array', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix', 'C++', 'Python3']