Medium
Find all cells that can flow to both oceans.
Water can flow from a cell to neighboring cells with height less than or equal to the current cell. Return all coordinates that can reach both the Pacific and Atlantic edges.
Examples
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: coordinates reaching both oceans
Constraints
- m x n grid