C++ || DFS || Similar to Number of Islands
Intuition\nSimple DFS involves calculating the sum of different islands and taking the maximum one.\nSimilar to Number of Islands problem (https://leetcode.com/
# Intuition\nSimple DFS involves calculating the sum of different islands and taking the maximum one.\nSimilar to Number of Islands problem (https://leetcode.com/problems/number-of-islands/).\n# Approach\nDepth First Search\n\n## Don\'t forget to upvote and give a like \uD83D\uDE43\n\n# Code\n```\nclass Solution {\npublic:\n    int dx[4] = {0,0,-1,1};\n    int dy[4] = {1,-1,0,0};\n    void dfs(int x,int y,vector<vector<int>>& grid,int* ans){\n        for(int next = 0;next<4;next++){\n            int x1 = x + dx[next];\n            int y1 = y + dy[next];\n            if(x1>=0 and y1>=0 and y1<grid[0].size() and x1<grid.size() and grid[x1][y1]!=0){\n                *ans += grid[x1][y1];\n                grid[x1][y1] = 0;\n                dfs(x1,y1,grid,ans);\n            }\n        }\n    }\n    int findMaxFish(vector<vector<int>>& grid) {\n        int m = grid.size();\n        int n  = grid[0].size();\n        //vector<vector<int>> vis(m,vector<int>(m,0));\n        int ans = 0;\n        for(int i = 0;i<m;i++){\n            for(int j = 0;j<n;j++){\n                if(grid[i][j] != 0){\n                    int count = grid[i][j];\n                    grid[i][j] = 0;\n                    dfs(i,j,grid,&count);\n                    ans = max(ans,count);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```\n### I hope the solution is clear; use the comment section regarding any doubt.
['Depth-First Search', 'Counting', 'C++']