Longest Common Subsequence

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • hard
  • Pro

Given two strings, find the length of the longest sequence of characters that appears in both in the same order, though not necessarily side by side. For example, "ace" is common to "abcde" and "ace". Explain how you'd set up the table and fill it.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →