Given an m x n grid of non-negative integers heights where heights[r][c] represents the height of the land at coordinate (r, c), return a list of coordinates [r, c] where water can flow to both the Pacific and Atlantic oceans.
The Pacific ocean touches the top and left borders of the grid. The Atlantic ocean touches the bottom and right borders. Water can flow from a cell to an adjacent cell (up, down, left, right) only if the adjacent cell's height is less than or equal to the current cell's height.
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] ]
Input: heights above Output: [[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]] Explanation: The highlighted cells can drain to both the Pacific (top/left border) and the Atlantic (bottom/right border).
Input: heights = [[1]] Output: [[0,0]] Explanation: A single cell touches all four borders, so it can reach both oceans.
m == heights.lengthn == heights[i].length1 <= m, n <= 2000 <= heights[r][c] <= 10^5heights = [[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]]