Longest Common Subsequence
Problem Statement
Given two strings, find the length of their longest common subsequence (LCS).
A subsequence is formed by deleting some (or no) characters without changing the order of remaining characters. For example, "ace" is a subsequence of "abcde" (delete b, d), but "aec" is not (wrong order).
word1 = "abcde" word2 = "ace" LCS = "ace", length = 3