Hi, I submitted the solution but at a test case may be 37th test case, it failed
1 2 3
8 9 4
7 6 5
Generated output : [[0,2],[1,0],[1,1],[1,2],[2,0],[2,2]]
Expected output : [[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]]
Why is the [2,1] included in expected output, it can't flow to pacific right ? i.e, the numbers left and top of 6 are both greater than 6. How is it possible ? Isn't the test case wrong here ?
Please clarify, thank you !!
I had this same issue (tried to do a dynamic programming solution). The thing is the water doesn't have to travel directly up or left to reach pacific, in this case it flows to the right then follows the path along the edge up all the way to the pacific. So it is not sufficient to check just above and to the left for pacific, and below and to the right for atlantic.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.