Solution 1
- For each box, there are two possible directions to approach it (from left or from top).
- Sum the two approaches together for the final result.
Space Complexity: O(m * n)Solution 2
- For each box, there are two possible directions to approach it (from left or from top).
- We store the number of unique paths for the last row we are traversing, s.t. we do not have to store the information
of previous rows.
Space Complexity: O(n)
PREVIOUSDecode Ways
NEXTJump Game