← All problems
Pacific Atlantic Water Flow
Cells with heights; find cells from which water flows to both oceans (borders).
Complexity
Time O(mn), Space O(mn)
Common pitfalls
- Wrong flow direction (must go uphill in reverse)
- Exponential per-cell DFS
Your solution
Log in to save your code and track progress.