Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Yes, you are right. This problem is about superstring not supersequences.
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"
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".
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