Pacific Atlantic Water Flow
Medium
Graphs
Array
BFS
DFS
Matrix
Given height matrix, find cells that can flow to both Pacific and Atlantic.
Constraints
m, n ≤ 200
Examples
Example 1:
Input: 1 2 2 3 5
3 2 3 4 4
2 4 5 3 1
6 7 1 4 5
5 1 1 2 4
Output: 0,4 1,3 1,4 2,2 3,0 3,1 4,0
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console