Simple java solution | same as Number of islands
replace "/"\n0 0 1\n0 1 0\n1 0 0\nreplace "\\"\n1 0 0\n0 1 0\n0 0 1\n\nsame as number of islands\n\n\nclass Solution {\n    public int regionsBySlashes(String[]
replace "/"\n0 0 1\n0 1 0\n1 0 0\nreplace "\\\\"\n1 0 0\n0 1 0\n0 0 1\n\nsame as number of islands\n\n```\nclass Solution {\n    public int regionsBySlashes(String[] grid) {\n     \n        int arr[][] = new int[grid.length*3][grid.length*3];\n        \n        for(int i=0; i<grid.length; i++){\n            for(int j=0; j<grid[i].toCharArray().length; j++){\n              \n                if(grid[i].charAt(j) ==\'/\'){\n                    arr[i*3][j*3+2] = 1;\n                    arr[i*3+1][j*3+1] = 1;\n                    arr[i*3+2][j*3] = 1;\n                }else if(grid[i].charAt(j) ==\'\\\\\'){\n                    arr[i*3][j*3] = 1;\n                    arr[i*3+1][j*3+1] = 1;\n                    arr[i*3+2][j*3+2] = 1;\n                }\n            }\n        }\n        \n        int regions =0;\n        \n        for(int i=0; i<arr.length; i++){\n            for(int j=0; j<arr[i].length; j++){\n                if(arr[i][j] == 0){\n                    dfs(arr, i, j);\n                    regions++;\n                }\n            }\n        }\n        return regions;\n    }\n    \n    private void dfs(int[][] arr, int i, int j){\n        \n        if(i<0 || i>=arr.length || j<0 || j>=arr.length || arr[i][j] == 1)\n            return;\n        arr[i][j] = 1;\n        dfs(arr, i-1, j);\n        dfs(arr, i+1, j);\n        dfs(arr, i, j-1);\n        dfs(arr, i, j+1);\n    }\n}\n```
[]