Resource · Guide or article
Shortest Common Supersequence
Defines the shortest common supersequence of two strings and notes its link to longest common subsequence.
Reviewed
Open the original: Shortest Common Supersequence (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
The shortest common supersequence (SCS) of two sequences X and Y is the shortest sequence which has X and Y as subsequences. In other words assume we're given two strings str1 and str2, find the shortest string that has both str1 and str2 as subsequences. This is a problem closely related to the longest common subsequence problem.
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Reference
What it covers
- Definition and relation to LCS.
- Two input and output examples, including geek and eke giving geeke.
How to use it
PrepKit study advice, not a claim made by the source.
Reuse an LCS table to build the SCS of AGGTAB and GXTXAYB, confirm your answer has length 9, and explain how the LCS length predicts it.
Scope and limitations
No solution method or complexity; the only reference is GeeksForGeeks.
Access and format
Free English README on GitHub, from trekhleb/javascript-algorithms (MIT).
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88
Evidence behind this overview
- src/algorithms/sets/shortest-common-supersequence/README.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.