Find the longest sequence of characters that appears in both strings in the same relative order (not necessarily contiguous). A fundamental DP problem used in diff tools, bioinformatics, and version control.
Given two strings s1 and s2, find the longest subsequence present in both. A subsequence keeps the original order but can skip characters. For example: s1 = "SUNDAY", s2 = "SATURDAY" → LCS = "SDAY" (length 4).
Green = shared subsequence "SDAY"