Grid with Pacific (top/left) and Atlantic (bottom/right). Water flows to equal/lower cells. Return cells that can reach both oceans.
heights = [[1,2,2,3,5],...][[0,4],[1,3],[1,4],...]Instead of tracing water down, trace reachability up from oceans. Non-decreasing path from border → cell means water can flow border→cell.