@Rishi Srivastava
In computer science, the shortest common supersequence (SCS) of two sequences X and Y is the shortest sequence which has X and Y as subsequences.
A shortest common supersequence is a common supersequence of minimal length. In the shortest common supersequence problem, two sequences X and Y are given, and the task is to find a shortest possible common supersequence of these sequences. In general, an SCS is not unique.
Problem: Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them.
Example:
Input: str1 = “abac“, str2 = “cab“
Output: “cabac“
Explanation:
str1 = “abac“ is a subsequence of “cabac“ because we can delete the first “c“.
str2 = “cab“ is a subsequence of “cabac“ because we can delete the last “ac“.
The answer provided is the shortest such
1 view
1755
559
2 weeks ago 00:21:22 1
Крым. Курортное. А где КУРОРТ?
2 weeks ago 01:10:14 1
Патриции - правящий класс АРиЯ-USSR в новую эру 12 лет 69 дней 22:22:22 МСК []
2 weeks ago 00:25:37 1
Почему MiSide НЕ ЗАСЛУЖИВАЕТ такого ХАЙПА.
2 weeks ago 00:05:53 1
Сергей Фургал устроил разнос чиновникам за барские замашки и расходы