Search⌘ K
AI Features

Pacific Atlantic Water Flow

Explore how to determine the cells on an island grid from which water can flow to both the Pacific and Atlantic oceans. Learn to analyze height matrices, implement optimal traversal strategies, and solve this common coding interview problem efficiently in O(m.n) time and space.

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 island is divided into ...