Facebook Pixel

Shortest Common Supersequence

Problem Statement

Given two strings, find the shortest string that contains both as subsequences.

str1 = "abac"
str2 = "cab"

SCS = "cabac" (length 5)

Verify:
- "abac" in "cabac": c[a][b][a][c] ✓
- "cab"  in "cabac": [c][a]b[a]c   ✓
Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro