Pacific Atlantic
i thought it can  work with travel in pacific with [i,j + 1] and [i + 1,0]  & in atlantic  with [ i ,j-1] and [i-1,0].but i was wrong\n\t\n\n\n\tclass Solution 
i thought it can  work with travel in pacific with [i,j + 1] and [i + 1,0]  & in atlantic  with [ i ,j-1] and [i-1,0].but i was wrong\n\t\n\n\n\tclass Solution {\n\tpublic:\n\t\tvector<vector<int>> dir = {{0,1},{1,0},{-1,0},{0,-1}};\n\n\t\tbool isSafe(int r,int c,int n,int m){\n\t\t\tif( r < 0 or c < 0 or r>=n or c>=m){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\tvoid dfs(vector<vector<int>>&grid,int r,int c,vector<vector<bool>> &visited)         {\n\n\t\t\tint curr = grid[r][c];\n\t\t\tvisited[r][c] = 1;\n\t\t\tfor(int i = 0; i<dir.size();i++){\n\t\t\t\tint r1 = r + dir[i][0];\n\t\t\t\tint c1 = c + dir[i][1];\n\n\n\t\t\t\tif(isSafe(r1,c1,grid.size(),grid[0].size()) and visited[r1][c1]==false and grid[r1][c1] >= curr){\n\t\t\t\t\tdfs(grid,r1,c1,visited);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tvector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {\n\n\n\t\t\tint n = heights.size();\n\t\t\tint m = heights[0].size();\n\t\t\tvector<vector<bool>> pacific(n,vector<bool>(m,0));\n\t\t\tvector<vector<bool>> atlantic(n,vector<bool>(m,0));\n\n\t\t\tfor(int i = 0; i<m;i++){\n\t\t\t\tif(pacific[0][i]==false){\n\t\t\t\t\tdfs(heights,0,i,pacific);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = 0; i<n;i++){\n\t\t\t\tif(pacific[i][0]==false){\n\t\t\t\t\tdfs(heights,i,0,pacific);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(int i = 0; i<m;i++){\n\t\t\t\tif(atlantic[n-1][i]==false){\n\t\t\t\t\tdfs(heights,n-1,i,atlantic);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(int i= 0; i<n;i++){\n\t\t\t\tif(atlantic[i][m-1]==false){\n\t\t\t\t\tdfs(heights,i,m-1,atlantic);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvector<vector<int>> ans;\n\n\t\t\tfor(int i = 0; i<n;i++){\n\t\t\t\tfor(int j = 0;j<m;j++){\n\t\t\t\t\tcout<<atlantic[i][j]<<" "<<pacific[i][j]<<" ,";\n\t\t\t\t\tif(atlantic[i][j] and pacific[i][j]){\n\t\t\t\t\t\tans.push_back({i,j});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcout<<endl;\n\t\t\t}\n\n\t\t\treturn ans;\n\t\t}
['Depth-First Search', 'Graph']