DSAverse
Dynamic Programming
Loading Dynamic Programming...
DP Table Filling
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
subproblems
O(2^n)→O(n)
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Dynamic Programming
Loading Dynamic Programming...
DP Table Filling
Watch 2D DP fill a table cell by cell to find the longest subsequence common to both strings, then backtrack to reconstruct it.
Click Play to begin
O(m × n)O(m × n)O(min(m,n))Question 1 of 3
When two characters match in the LCS DP table, what is dp[i][j]?