Longest common subsequence
Two signs read “planet” and “panel”. Which letters can you keep on both signs so they match and as many letters as possible remain?
You may skip letters. The ones you keep must appear in their original order in both words.
Each cell gives the longest common subsequence length for two prefixes. The symbol ε means an empty string.
Words of lengths m and n use (m + 1) × (n + 1) cells. Each cell takes constant time.