You are given two strings, str1 and str2. Your task is to find the shortest common supersequence (SCS). The shortest possible string that contains both str1 and str2 as subsequences.
If multiple strings satisfy this condition, you may return any one of them.
Note: A string
s is considered a subsequence of another stringt ifs can be obtained by deleting zero or more characters fromt without changing the order of the remaining characters.
Constraints:
str1.length, str2.length
You are given two strings, str1 and str2. Your task is to find the shortest common supersequence (SCS). The shortest possible string that contains both str1 and str2 as subsequences.
If multiple strings satisfy this condition, you may return any one of them.
Note: A string
s is considered a subsequence of another stringt ifs can be obtained by deleting zero or more characters fromt without changing the order of the remaining characters.
Constraints:
str1.length, str2.length