✔ Simple java solution
\nclass Solution {\n  int dir[][] = {{0,1}, {0,-1}, {1,0}, {-1,0}};\n    public List<List<Integer>> pacificAtlantic(int[][] matrix) {\n        List<List<Integer
```\nclass Solution {\n  int dir[][] = {{0,1}, {0,-1}, {1,0}, {-1,0}};\n    public List<List<Integer>> pacificAtlantic(int[][] matrix) {\n        List<List<Integer>> res = new ArrayList<>();\n        if(matrix == null || matrix.length == 0 || matrix[0].length == 0) \n            return res;\n        \n        int row = matrix.length, col = matrix[0].length;\n        boolean[][] pacific = new boolean[row][col];\n        boolean[][] atlantic = new boolean[row][col];\n        \n        //DFS\n        for(int i = 0; i < col; i++){\n            dfs(matrix, 0, i, Integer.MIN_VALUE, pacific);\n            dfs(matrix, row-1, i, Integer.MIN_VALUE, atlantic);\n        }\n        for(int i = 0; i < row; i++){\n            dfs(matrix, i, 0, Integer.MIN_VALUE, pacific);\n            dfs(matrix, i, col-1, Integer.MIN_VALUE, atlantic);\n        }\n        \n        //preparing the result\n        for(int i = 0; i < row; i++){\n            for(int j = 0; j < col; j++) {\n                if(pacific[i][j] && atlantic[i][j]) {\n                    res.add(Arrays.asList(i,j));\n                }\n            }\n        }\n        \n        return res;\n    }\n    \n    public void dfs(int[][] matrix, int i, int j, int prev, boolean[][] ocean){\n        if(i < 0 || i >= ocean.length || j < 0 || j >= ocean[0].length) return;\n        if(matrix[i][j] < prev || ocean[i][j]) return;\n        ocean[i][j] = true;\n        for(int[] d : dir){\n            dfs(matrix, i+d[0], j+d[1], matrix[i][j], ocean);\n        }\n        \n    }\n}\n```\n\n**113 / 113 test cases passed.\nStatus: Accepted\nRuntime: 6 ms\nMemory Usage: 55.4 MB**
['Depth-First Search', 'Java']