Given the original sequence org and a list of subsequences seqs, return true if org can be uniquely reconstructed from seqs. Pattern focus: Applications. This checks whether the topological order is unique.
org = original sequence, seqs = list of subsequences
true if org is the unique reconstruction
Example 1:
Input:
org = [1,2,3] seqs = [[1,2],[1,3],[2,3]]
Output:
true
Explanation:
The constraints force the unique order 1 -> 2 -> 3.
Example 2:
Input:
org = [1,2,3] seqs = [[1,2],[1,3]]
Output:
false
Explanation:
Both 1 -> 2 -> 3 and 1 -> 3 -> 2 satisfy the subsequences, so reconstruction is not unique.
Example 3:
Input:
org = [4,1,5,2,6,3] seqs = [[5,2,6,3],[4,1,5,2]]
Output:
true
Explanation:
The subsequences enforce the exact original order.