本文へスキップ

リソース · ガイド・記事

Longest common subsequence problem

最長共通部分列の問題を定義し、最長共通部分文字列との違いを説明しています。DP の定番の面接問題です。

確認日

元のサイトを開く: 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 編集部がソースリポジトリをもとに執筆・確認したもので、リソース本文の引用ではありません。

対象
ソースにレベルの記載はありません
形式
リファレンス

扱っている内容

  • 部分列と部分文字列の区別。
  • 差分ツール、バイオインフォマティクス、バージョン管理などの応用。
  • LCS とその長さを示した2つの例。

使い方

PrepKit の学習アドバイスであり、ソースの主張ではありません。

ABCDGH と AEDFHR の LCS 表を手で埋めて ADH を復元し、それからコードにしてください。

範囲と制約

解法も計算量も示されておらず、それにはリンク先の Wikipedia のページか動画が必要です。

利用方法と形式

GitHub にある英語の無料 README です(trekhleb/javascript-algorithms、MIT)。

PrepKit が 2026/10/02 に確認しました。 リソースの出典のコミット: 85293e3e2b88

この概要の根拠
  • src/algorithms/sets/longest-common-subsequence/README.md

この項目を掲載しているページ

PrepKit ニュースレターを受け取る

任意です。PrepKit の利用には必要ありません。

メールアドレスの取り扱いについて