Java Easy Solution
Upvote if you like the solution\n```\nclass Solution {\n    static int[][] dir={{0,1},{0,-1},{1,0},{-1,0}};\n    public List> pacificAtlantic(int[][] heights) {
Upvote if you like the solution\n```\nclass Solution {\n    static int[][] dir={{0,1},{0,-1},{1,0},{-1,0}};\n    public List<List<Integer>> pacificAtlantic(int[][] heights) {\n        List<List<Integer>> ans=new ArrayList<>();\n        int m=heights.length;\n        int n=heights[0].length;\n        boolean[][] pac=new boolean[heights.length][heights[0].length];\n        boolean[][] atl=new boolean[heights.length][heights[0].length];\n        \n        for(int i=0;i<n;i++){\n            dfs(heights,0,i,Integer.MIN_VALUE,pac);\n            dfs(heights,m-1,i,Integer.MIN_VALUE,atl);\n        }\n        for(int j=0;j<m;j++){\n            dfs(heights,j,0,Integer.MIN_VALUE,pac);\n            dfs(heights,j,n-1,Integer.MIN_VALUE,atl);\n        }\n        for(int i=0;i<m;i++){\n            for(int j=0;j<n;j++){\n               if(pac[i][j] && atl[i][j]){\n                   List<Integer> l=new ArrayList<>();\n                   l.add(i);\n                   l.add(j);\n                   ans.add(l);\n               }\n            }\n        }\n        return ans;\n    }\n    public static void dfs(int[][] heights,int i, int j,int prev, boolean[][] arr){\n        if(i<0 || j<0 || i>=heights.length || j>=heights[0].length || arr[i][j]==true || heights[i][j]<prev)return;\n        \n        arr[i][j]=true;\n        for(int k=0;k<4;k++){\n            int x=i+dir[k][0];\n            int y=j+dir[k][1];\n            \n            dfs(heights,x,y,heights[i][j],arr);\n        }\n        \n        \n    }\n}
['Java']