Pacific Atlantic Water Flow (Extra) Problem

Pacific Atlantic Water Flow (Extra) Problem — ExecCode Medium DSA Practice

Solve the Pacific Atlantic Water Flow (Extra) problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Pacific Atlantic Water Flow (Extra). Multi-source DFS from oceans. For Pacific Atlantic Water Flow (Extra), focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input heights = [[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]]

Constraints

1 ≤ n ≤ 10^5

Practice Pacific Atlantic Water Flow (Extra) free on ExecCode. Browse DSA problems, topic map, and placement guides.