Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Pacific Atlantic Water Flow (medium)

Problem Statement:

You are given a matrix grid of size m x n, where each matrix[i][j] represents the height of the Island at i<sup>th</sup> row and j<sup>th</sup> column position from the sea level. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges.

Due to heavy rain, there is a lot of water on each cell of the island. It is given that the rain water can flow to neighboring cells directly north, south, east, and west if the neighboring cell's height is `less than or equal to

.....

.....

.....

Like the course? Get enrolled and start learning!