Wrong test case ? (Solved)


  • 0
    I

    Hi, I submitted the solution but at a test case may be 37th test case, it failed

    Given matrix:
    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 !!


  • 0
    C

    6 -> 5 -> 4 -> 3-> 2 -> 1


  • 0
    I

    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.


  • 0
    I

    Thank you for clarifying my doubt !!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.