LeetCode ποΈ/Dynamic Programming
62. Unique Paths
KB0129
2023. 7. 5. 02:05
Description:
Solution:
row = [1] * n => The bottom row: [1, 1, 1, 1, 1, 1, 1]
We start from (n-2) with reverse order. When we complete the second row[7, 6, 5, 4, 3, 2, 1], we update this newRow as row.
Time Complexity: O(n*m)
Space Complexity: O(n)