# Dynamic Programming - 2D

# Longest Common Subsequence

Given two strings x and y, find the longest common subsequence (LCS) and print its length. (For string `ABCBDAB`

and `BDCABC`

, `BCAB`

is the LCS, so return 4).

1 | for(i = 0; i <= n; i++) D[i][0] = 0; |

# Edit Distance

Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. 3 operations are permitted on a word: **insert**, **delete** or **replace** a character.

1 | for (int i=0; i<=m; i++) |