Search⌘ K
AI Features

Pacific Atlantic Water Flow

Explore how to identify island cells where rainwater can flow to both the Pacific and Atlantic oceans using matrix elevations. Learn to implement an efficient O(mn) time solution and understand the flow logic based on cell height comparisons.

Statement

Imagine an island with a rectangular shape that touches both the Pacific and Atlantic oceans. The northern and western sides meet the Pacific, while the southern and eastern sides touch the Atlantic. This ...