Search⌘ K
AI Features

Pacific Atlantic Water Flow

Understand how to determine which cells on a rectangular island allow rainwater to flow into both the Pacific and Atlantic oceans by analyzing their heights. Learn to implement an efficient algorithm that tracks water flow paths using elevation data represented in a matrix. This lesson helps you practice matrix traversal and problem-solving techniques for coding interviews.

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 ...