##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
You know basic string matching. Now solve Edit Distance, LCS variants, and two-sequence alignment problems with multi-dimensional DP tables.
Sequences, alignment, transformation
Two strings → dp[i][j]
LC 10 - dot and star patterns
Star means zero or more of previous
dp[i][j] = does prefix match?
Zero times or extend match
Empty vs patterns like a*b*
Handle *, then .
O(mn) both time and space
.* matches everything
Operators create branches
LC 97 - merge two strings
Start leaning basics.
dp[i][j] uses s3[i+j-1]
Start leaning basics.
LC 131 - all palindrome partitions
Precompute isPalin[i][j]
Interval DP for palindrome check
SCS = len1 + len2 - LCS
Backtrack through LCS table
LC 5 - longest palindrome substring
Expand around center or DP
LC 139 - dictionary segmentation
dp[i] = prefix can be split?
Which pattern is this?
Empty string, single char
1-indexed DP, 0-indexed strings
LC 87
Solution approach
LC 730
Solution approach
LC 940
Solution approach
LC 1278
Solution approach
LC 1639
Solution approach
From edit distance to word break