easy c++ sol
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<vector<int>> visited;
    vector<vector<int>> dir = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
    int count = 0;
    int bfs(int i, int j, vector<vector<int>>& grid) {
        queue<pair<int, int>> q;
        q.push({i, j});
        int ans = 0;
        while (q.size()) {
            int a = q.front().first;
            int b = q.front().second;
            q.pop();
            visited[a][b] = 1;
            ans += grid[a][b];
            cout<<"value : "<<grid[a][b]<<" ";
            for (int k = 0; k < 4; k++) {
                int x = a + dir[k][0];
                int y = b + dir[k][1];
                if (x < 0 || y < 0 || x >= grid.size() || y >= grid[0].size() ||
                    grid[x][y] == 0 || visited[x][y] == 1)
                    continue;
                else
                    cout<<x<<" "<<y<<" "<<endl;
                    visited[x][y]=1;
                    q.push({x, y});
            }
        }
        return ans;
    }
    int findMaxFish(vector<vector<int>>& grid) {
        visited.clear();
        visited.resize(grid.size(), vector<int>(grid[0].size(), 0));
        for (int i = 0; i < grid.size(); i++) {
            for (int j = 0; j < grid[0].size(); j++) {
                // 0 means land else water
                if (grid[i][j] != 0 and visited[i][j] == 0) count = max(count, bfs(i, j, grid));
            }
        }
        return count;
    }
};
```
['C++']