Longest Common Subsequence

Learn to use dynamic programming in string-based problems.

Problem statement

Given two sequences, find the length of the longest subsequence present in both of them.

A subsequence is a sequence that appears in the same relative order but is not necessarily contiguous. For example, abc, abg, bdf, aeg, acefg…etc., are subsequences of abcdefg. So a string of length n has 2n{2^{n}} ...