Shortest Common Supersequence
A hard-tier problem at 61% community acceptance, tagged with String, Dynamic Programming. Reported in interviews at Dream11 and 0 others.
Shortest Common Supersequence is a hard DP problem that shows up in your OA and you instantly regret not drilling it sooner. Dream11 has confirmed they ask it. The trap is that most candidates know Longest Common Subsequence but choke on the reconstruction step, the part that actually matters. You need to not just find the LCS length, but build the actual string from it. That reconstruction is where the problem lives. If you blank during the live assessment, StealthCoder surfaces a working solution invisible to the proctor so you move on and finish the test.
Companies that ask "Shortest Common Supersequence"
Shortest Common Supersequence is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe algorithm lives in two phases. Phase one: standard DP table for LCS between both strings, tracking lengths. Phase two: backtrack through that table to rebuild the supersequence character by character, inserting chars from both strings and skipping matched pairs. Most engineers nail phase one and then improvise phase two, which fails. The supersequence must include every character from both strings, using common characters only once. Common mistake: trying to build it forward or greedy instead of backtracking. Another trap: forgetting to append remaining characters from both strings when you hit a table boundary. If this hits your OA and the backtracking logic doesn't click, StealthCoder runs invisibly during screen share and gives you the working reconstruction pattern so you paste a correct solution.
Pattern tags
You know the problem.
Make sure you actually pass it.
Shortest Common Supersequence recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Shortest Common Supersequence interview FAQ
Is this actually asked at top companies or just theoretical?+
Dream11 has confirmed asking it. It's a hard-tier DP problem, so expect it in final-round OAs for senior roles. Less frequent than easier DP problems, but the acceptance rate is solid at 61 percent, meaning it's solvable and companies do use it to filter.
What's the trick I'm missing if I get LCS but can't build the answer?+
You need to backtrack through your DP table diagonally, comparing characters and building the supersequence as you go. When chars match, move diagonally and add that char once. When they don't, move in the direction of the larger DP value and add the char from that string. Most people skip the backtrack step entirely.
How does this relate to Longest Common Subsequence?+
LCS is the foundation. You build the LCS DP table first, then reconstruct. The supersequence length equals len(str1) + len(str2) - len(LCS). Understanding LCS deeply makes this problem tractable, but reconstruction is the real skill being tested.
What's the time and space complexity I should target?+
O(m*n) time for the DP table and O(m+n) for the output string, where m and n are string lengths. Space is O(m*n) for the table. If your solution is exponential or uses recursion without memoization, you'll TLE on large inputs.
How do I not mess up the backtracking part during the live test?+
Draw the DP table on paper first with a small example to see the pattern. Then code the backtrack loop carefully, checking both boundary conditions and the comparison logic. Off-by-one errors here are common. If you hit a wall, StealthCoder solves it invisibly so you get a working solution down and move on.
Want the actual problem statement? View "Shortest Common Supersequence" on LeetCode →