In this post, we are going to discuss leetcode 1143 — Longest Common Subsequence, which is recently asked in Amazon interviews.
Problem Analysis
Given two strings
text1
andtext2
, return the length of their longest common subsequence. If there is no common subsequence, return0
.A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.