Dynamic Programming
1 | class Solution { |
Remarks:
- Adapted from No. 62.
- TC: $O(m\times n)$, SC: $O(m\times n)$.
DP with pruning (top-buttom)
1 | class Solution { |
Remarks:
- TC: $O(m\times n)$, SC: $O(m\times n)$.
- Pruning: only calculate the blocks that are required to find the minimum path. Larger stack usage.