ONE OF THE BEST QUESTION || DFS
One of the best question i have ever seen on leetcode , i got many things to learn.\nLet\'s come to the solution , here we can divide each character of grid int
**One of the best question i have ever seen on leetcode , i got many things to learn**.\nLet\'s come to the solution , here we can divide each character of ***grid*** into *3 X 3 grid*\nso the total new vector become of size 3 x n  and mark every / and \\ with 1 and other blocks with 0.\nNow the question is of no. of islands we can have if 0 is land and 1 is water .\n```\nclass Solution {\npublic:\n    void islandcolor(int i,int j,vector<vector<int>> &island,int n)\n    {\n        if(i<0 or i>=n or j<0 or j>=n or island[i][j]==1)\n            return;\n        island[i][j]=1;\n        islandcolor(i+1,j,island,n);\n        islandcolor(i,j+1,island,n);\n        islandcolor(i-1,j,island,n);\n        islandcolor(i,j-1,island,n);\n    }\n   \n    int regionsBySlashes(vector<string>& grid) {\n        int n=grid.size();\n        vector<vector<int>> a(3*n,vector<int> (3*n));\n        for(int i=0;i<3*n;i++)\n        {\n            for(int j=0;j<3*n;j++)\n            {\n                a[i][j]=0;\n            }\n        }\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<n;j++)\n            {\n                int basex=3*i;\n                int basey=3*j;\n                if(grid[i][j]==\'/\')\n                {\n                    for(int i=0;i<3;i++)\n                    {\n                        a[basex+2-i][basey+i]=1;\n                    }\n                }\n               else if(grid[i][j]==\'\\\\\')\n                {\n                    for(int i=0;i<3;i++)\n                    {\n                        a[basex+i][basey+i]=1;\n                    }\n                }\n            }\n        }\n        int ans=0;\n        bool visited[3*n][3*n];\n        memset(visited,false,sizeof(visited));\n         for(int i=0;i<3*n;i++)\n        {\n            for(int j=0;j<3*n;j++)\n            {\n                if(a[i][j]==0 )\n                {\n                    ans++;\n                    islandcolor(i,j,a,3*n);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```\n***Don\'t forget to upvote ***\n
['Depth-First Search', 'Union Find', 'Graph', 'Recursion', 'C']