AlgoMaster Logo

Pacific Atlantic Water Flow

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]]
0 / 110
PacificAtlantic1223532344245316714551124
algomaster.io
Step:Find every cell whose rainwater can reach BOTH the Pacific and the Atlantic