diff --git a/Dsa/NumberofDistinctIsland.cpp b/Dsa/NumberofDistinctIsland.cpp new file mode 100644 index 0000000..2a6d311 --- /dev/null +++ b/Dsa/NumberofDistinctIsland.cpp @@ -0,0 +1,37 @@ +// Number of Distinct Islands +// GFG +class Solution { + public: + void helper(vector> &grid,int i,int j,string &st){ +if(i<0 || j<0 || i>=grid.size() || j>=grid[0].size() || grid[i][j]==0)return ; + grid[i][j]=0; + st=st+"d"; + helper(grid,i+1,j,st); + st=st+"u"; + helper(grid,i-1,j,st); + st=st+"r"; + helper(grid,i,j+1,st); + st=st+"l"; + helper(grid,i,j-1,st); + } + int countDistinctIslands(vector>& grid) { + // code here + int count=0; + int n=grid.size(); + int m=grid[0].size(); + unordered_map mp; + for(int i=0;i