DFS Python3, easy to understand with comments.
Please +1 if you like the solution\n\nclass Solution:\n    def pacificAtlantic(self, matrix: List[List[int]]) -> List[List[int]]:\n        if not matrix or not 
Please +1 if you like the solution\n```\nclass Solution:\n    def pacificAtlantic(self, matrix: List[List[int]]) -> List[List[int]]:\n        if not matrix or not matrix[0]:\n                return []\n    \n        # list which will have both the coordinates\n        pacific = set()\n        atlantic = set()\n        # get the number of rows and columns\n        m,n = len(matrix), len(matrix[0])\n\n        # define left, right, up, down\n        directions = [(-1,0),(1,0),(0,1),(0,-1)]\n\n        # define the dfs traversal\n        def dfs(visited, x,y):\n            visited.add((x,y))\n            for dx, dy in directions:\n                new_x, new_y  = x + dx, y + dy\n\n                # if the coordinates are valid and if c(i) > c (i-1)\n                if 0 <= new_x < m and 0 <= new_y < n and (new_x, new_y) not in visited and matrix[new_x][new_y] >= matrix[x][y]:\n                    dfs (visited, new_x, new_y)\n\n        # iterate for rows\n        for i in range(m):\n            dfs(pacific, i , 0)\n            dfs(atlantic, i, n-1)\n\n        # iterate for columns\n        for j in range(n):\n            dfs(pacific, 0 , j)\n            dfs(atlantic, m-1, j)\n\n        # return the matching coordinates\n        return list(pacific.intersection(atlantic))\n\n```
['Depth-First Search', 'Python3']