Easy to understand || Simple DFS
Given : We can start at any water cell \n#So why not do the same\n#For a given water cell, collect all the fishes from the cells which are \u2018connected\u2019
#Given : We can start at any water cell \n#So why not do the same\n#For a given water cell, collect all the fishes from the cells which are **\u2018connected\u2019 [directly/indirectly]** from that cell\n#So **get the count of fishes for each connected component, and then take the maximum**\n\n![image](https://assets.leetcode.com/users/images/3c92b14c-6fce-4335-9244-561701786f6b_1682784101.8203545.png)\n\n\n```\nclass Solution {\npublic:\n    vector<int>rowDir = {-1, 1, 0, 0}; //top, bottom, left, right\n    vector<int>colDir = {0, 0, -1, 1};\n    int dfs(vector<vector<int>>&grid, int row, int col)\n    {\n        if (row < 0 || col < 0 || row == grid.size() || col == grid[0].size()) return 0;\n        if (grid[row][col] == 0) return 0;\n       \n        int sum = grid[row][col]; //include fish count of current cell\n        grid[row][col] = 0; //mark curr cell as visited [make it a water cell]\n        for (int dirIdx = 0; dirIdx < 4; dirIdx++)\n        {\n            int newRow = row + rowDir[dirIdx];\n            int newCol = col + colDir[dirIdx];\n            sum += dfs(grid, newRow, newCol); //add fish count of all connected cells to sum\n        }\n        return sum;\n    }\n    int findMaxFish(vector<vector<int>>& grid)\n    {\n        int m = grid.size(), n = grid[0].size();\n        int maxCount = 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) continue; //if it is a water cell \n                \n                int collectedCount = dfs(grid, i, j);\n                maxCount = max(maxCount, collectedCount);\n            }\n        }\n        return maxCount;\n        \n    }\n};\n```
['Depth-First Search', 'C', 'C++']