跳到主要内容

资源 · 指南或文章

Longest common subsequence problem

定义最长公共子序列问题及其与最长公共子串的区别,这是一道经典的动态规划面试题。

审核日期

打开原站: Longest common subsequence problem (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences). It differs from the longest common substring problem: unlike substrings, subsequences are not required to occupy consecutive positions within the original sequences. The longest common subsequence problem is a classic computer science problem, the basis of data comparison programs such as the diff utility, and has applications in bioinformatics. It is also widely used by revision control systems such as Git for reconciling multiple changes made to a revision-controlled collection of files.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • 子序列与子串的区别。
  • 应用,例如 diff 工具、生物信息学和版本控制。
  • 两个示例及其 LCS 和长度。

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

手动为 ABCDGH 和 AEDFHR 填写 LCS 表,还原出 ADH,然后编写代码。

范围与局限

没有给出求解方法或复杂度;这些需要查看链接的维基百科页面或视频。

获取方式与形式

GitHub 上的免费英文 README(trekhleb/javascript-algorithms,MIT)。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/algorithms/sets/longest-common-subsequence/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱