Question is unclear to me, why 1, 2 should have ouput of 1?


  • 0
    R

    why [1,2] should not have output of 3? the judge says that the output should be one

    --------
    |  |   |   
    -------
    

    if the above is the grid with 1 row and 2 columns then there is definitely 3 ways to go:

    ----------
             |
    
    ----
        |
         -----
    
    |
    ----------

  • 1
    L

    You're moving along the edges of the squares instead of between squares. You're moving between nodes at the centers of the squares. [1, 2] has only 2 nodes:

    • •

    and only one path between them.

    You were interpreting it as this:

    • • •

    • • •

    Which has three paths but would have dimensions [2, 3]


Log in to reply
 

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