Return grid coordinates where water can flow to both Pacific and Atlantic oceans.
Input: heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]
Output: 7 cells
Topics: graphs
Asked by: Google, Amazon
Time complexity: O(m*n). Space complexity: O(m*n).