less than 1 minute read

Given strings a and b, return the length of the shortest string that has both a and b as subsequences.

https://binarysearch.com/problems/Shortest-Common-Supersequence

Examples

Example 1

Input

  • a = bell
  • b = yellow

Output

  • answer = 7

Explanation

One possible solution is "ybellow".

Solution

Leave a comment