Search
⌘K

Leetcode 417. Pacific Atlantic Water Flow

Given an m×n height grid where water can flow from a cell to any neighbor of lesser-or-equal height, return all coordinates from which water can reach both the Pacific (top/left edges) and Atlantic (bottom/right edges). The core challenge is a graph/grid reachability problem typically solved by two multi-source traversals (BFS/DFS) from the ocean borders, propagating uphill (to equal-or-higher heights) and intersecting the reachable sets.

Asked at:

Meta

M

Merge


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early April, 2025

M

Merge

Senior

Late November, 2024

Meta

Junior

Solve a variation of Pacific Atlantic Water Flow without oceans

Comments

Your account is free and you can post anonymously if you choose.