problem
給定兩字串,找出最長共同子序列(common subsequence)的長度
solution
option 1 - dp
1 | class Solution { |
option 2 - Hunt–Szymanski Algorithm
analysis
- time complexity
O(n*m)
- space complexity
O(n*m)
給定兩字串,找出最長共同子序列(common subsequence)的長度
1 | class Solution { |
O(n*m)
O(n*m)