problem
solution
option 1 - dfs + memo => maybe TLE
1 | class Solution { |
option 2 - dp
1 | class Solution { |
option 3 - dp
1 | class Solution { |
analysis
- option 2 - dp
- time complexity
O(n*dict.size())
- space complexity
O(n)
- time complexity
1 | class Solution { |
1 | class Solution { |
1 | class Solution { |
O(n*dict.size())
O(n)