Ad
  • Custom User Avatar

    Yes, you are right. This problem is about superstring not supersequences.

  • Default User Avatar

    Wouldn't that become a shortest common superstring? i.e each of the input string a substring of the output string.

    According to wikipedia: https://en.wikipedia.org/wiki/Shortest_common_supersequence_problem
    input : ["abcbdab", "bdcaba"]
    output: "abdcabdab"

  • Custom User Avatar

    All of the preceding and succeeding letters need to match in the subsequences.

    In your first example, you're matching at the 'o' in "hello" and "world", but before the 'o' in "hello" is 'l' and not 'w'.

    Same for the other input. All of the preceding and succeeding letters should match, so that answer should be "abcdejdek" since you can't match the 'k' with "cdejd".

  • Default User Avatar

    Input: "hello", "world":
    My program Output: hellworld
    ---------error log -------------------
    Shortest common sequence: "hellworld" should contain all of the words: "hello", world". - Expected: false, instead got: true
    Shortest common sequence should be no longer than "10" (e.g. "helloworld") , got "9" ("hellworld") instead - Expected: 9, instead got: 10

    As the question asks for supersequence: "hellworld" output should be fine. However test cases reject this output.
    Could somebody clarify what am I missing here?

    Same issue with input ["abcde", "dek", "cdejd"], my output: abcdekjd