Coding

Pacific and Atlantic Water Flow

Calculate water flow from a matrix to the Pacific and Atlantic oceans.

Input: heights = [[2,1],[1,2]]

Output: [[0,0],[0,1],[1,0],[1,1]]

Explanation: All cells can flow to both oceans because water can move to adjacent cells of equal or lower height or directly off the edges.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions