✨💯EASY SOLUTION.. direct and simple implementation, super easy to understand...✨✨💯💯
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int>parent;\n\n    int findP(int x){\n        if(parent[x]==x)return x;\n        else\n        return findP(parent[x]);\n    }\n\n    int regionsBySlashes(vector<string>& grid) {\n\n        vector<vector<int>>mat(grid.size()+1,vector<int>(grid.size()+1));\n        int n=mat.size();\n        parent.resize(n*n);\n\n        for(int i=0;i<n;i++){\n            for(int j=0;j<n;j++){\n                if(i==0||j==0 || i==n-1 || j==n-1){\n                    parent[i*n+j]=0;\n                }else{\n                    parent[i*n+j]=(i*n)+j;\n                }\n            }\n        }\n\n        int ans=1;\n        for(int i=0;i<grid.size();i++){\n            for(int j=0;j<grid.size();j++){\n                if(grid[i][j]==\'/\'){\n                    int par1=findP(i*n+(j+1));\n                    int par2=findP((i+1)*n+j);\n                    if(par1==par2)ans++;\n                    else{\n                        parent[par1]=par2;\n                    }\n                }\n                else if(grid[i][j]==\'\\\\\'){\n                    int par1=findP(i*n+j);\n                    int par2=findP((i+1)*n+(j+1));\n                    if(par1==par2)ans++;\n                    else{\n                        parent[par1]=par2;\n                    }\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'Hash Table', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix', 'C++']