799. Champagne Tower ¶
Approach 1: 2D DP¶
- Time: $O(|\texttt{query_row}|^2)$
- Space: $O(n^2)$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Approach 2: 1D DP¶
- Time: $O(|\texttt{query_row}|^2)$
- Space: $O(n)$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|