• I have really struggled with this one just to understand what this question is asking. At first I thought it was saying something like

can you fit the sub-sequences on top of the original sequence so that the whole original sequence is covered? Sub-sequences that cannot be overlayed on to the original sequence are discarded. But, after coding that up and failing the test cases, clearly that is not what they are asking.

Here is one their example test cases from the problem statement:

``````Input:
org: [1,2,3], seqs: [[1,2],[1,3]]

Output:
false

Explanation:
[1,2,3] is not the only one sequence that can be reconstructed, because [1,3,2] is also a valid sequence that can be reconstructed.
``````

I read this and I think well "[1,3]" is not a valid sub-sequence so throw that away and "[1,2]" is valid but is not enough to cover the original sequence. But that is not what is going on because they say these sub-sequences can form "[1,2,3]" AND "[1,3,2]".

Um, huh????

What can you do with "[1,3]"?

• Since I don't see the question myself but here's my point of view towards their explanation of test cases.
[[1,2], [1,3]] failed because [1,2] & [1,3] can make [1,3,2], which is differ from the org:[1,2,3].

It seem that this method require the seqs parameters should make only distinct one combintation, same as the org. Otherwise output false.

But I saw some posts complain that there're some error C# testcaes on this question. Let's wait.

• @new2500 regardless of any test case issues, I'm still not understanding how you can make either sequence
"[1,2,3]" or "[1,3,2]" from the sub-sequences "[1,2]", [1,3]". I think I'm missing the basic concept here.

Does it have to do with a sub-sequence is not necessary a continuous slice of the original?

• @jdrogin
[1,2,3] = [1,2] + 3 from[1,3]
[1,3,2] = [1,3] + 2 from [1,2]

• Example 1
seqs = `[[1,2], [1,3]]`

Question: Using `seqs`, what are the shortest common supersequences we can make?
Answer: `[1,2,3]` and `[1 3 2]`.

Explanation:

• `[1,2,3]` is valid because every sequence in `seqs` is a subsequence of `[1,2,3]`
``````[1,2,3]    [1,2,3]
* *        *   *
``````
• `[1,3,2]` is valid because every sequence in `seqs` is a subsequence of `[1,3,2]`
``````[1,3,2]    [1,3,2]
*   *      * *
``````

Solution: FALSE, because these supersequences are not unique.

Example 2
seqs = `[[1,2],[1,3],[2,3]]`

Question: Using `seqs`, what are the shortest common supersequences we can make?
Answer: `[1,2,3]`

Explanation:

• `[1,2,3]` is valid because every sequence in `seqs` is a subsequence of `[1,2,3]`
``````[1,2,3]    [1,2,3]    [1,2,3]
* *        *   *        * *
``````

Solution: TRUE. Since solution is unique and equal to target `[1,2,3]`.

• @sys AHHH!!! Great explanation, this clears it up. I get it now. Thank you very much for helping me out!

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.