← All problems
Letters in common, in order
Problem
Given two strings a and b, return the length of their longest common subsequence: the longest sequence of characters that appears in both in the same relative order, but not necessarily contiguously.
Examples
Input: "abcde", "ace"
Output: 3
"ace"
Input: "abc", "def"
Output: 0
Hints
Try it first. Every hint reveals a bit more.