Longest Common Subsequence

Medium · Dynamic Programming · about 20 minutes

Asked at Google, Amazon, Microsoft.

Find the longest sequence of characters that you can get from both text1 and text2 by deleting characters (keeping the rest in order), and return its length. If they share no characters, return 0.

Related guides