For a 2x3 grid I see four paths, but the judge tells me there are only 3


  • 0
    G

    For a 2x3 grid I see the following paths:

    1. right right down:

       +---+---+---+
       | → | → | ↓ |
       +---+---+---+
       |   |   | x |
       +---+---+---+
      
    2. down right right:

       +---+---+---+
       | ↓ |   |   |
       +---+---+---+
       | → | → | x |
       +---+---+---+
      
    3. right down right:

       +---+---+---+
       | → | ↓ |   |
       +---+---+---+
       |   | → | x |
       +---+---+---+
      
    4. down right up right down:

       +---+---+---+
       | ↓ | → | ↓ |
       +---+---+---+
       | → | ↑ | x |
       +---+---+---+
      

    However, as I said, when I use 2 and 3 as input, I'm told that the expected answer is 3.

    What am I doing wrong?


  • 0
    W

    The robot can only move either down or right at any point in time. so the fourth path is invalid.


  • 0
    G

    Thanks, I realized that 2 minutes after asking the question :)


Log in to reply
 

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