Solution 1: accepted 1ms
Two-dimension DP: For ways to current position, w(current), equals to ways to its top plus ways to its left, w(current) = w(top) + w(left).
Time: O(mn)
Space: O(mn)
|
|
Solution 2:
One-dimension DP.
Two-dimension DP: For ways to current position, w(current), equals to ways to its top plus ways to its left, w(current) = w(top) + w(left).
Time: O(mn)
Space: O(mn)
|
|
One-dimension DP.