You are given an m × n integer grid heights representing terrain elevations. The Pacific Ocean touches the grid’s top and left edges; the Atlantic Ocean touches the bottom and right edges.
Water flows from a cell to a neighboring cell (up/down/left/right) only if the neighbor’s height is less than or equal to the current cell’s height. Water at any edge cell can flow directly into the ocean that edge borders.
Return every cell [r, c] from which water can reach both oceans.
Output ordering (required): return the coordinates sorted ascending by row, then by column.
[[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]][[1]][[2,1],[1,2]][[1,2,3],[8,9,4],[7,6,5]][[3,3,3],[3,1,3],[3,3,3]][[10,10,10],[10,1,10],[10,10,10]]