+1 vote
X = [a, ab, bc, ad]

Y = [bc, cab, dab, ac]
by AlgoMeister (1.6k points)

2 Answers

+1 vote
 
Best answer
No. There is no solution.

If we start with 0, 1 or 2, sequence in Y will always be at least 1 character longer than sequence in X, and there is no way to make the Y sequence shorter (since the shortest one in Y has a length of 2 and the longest one in x also has a length of 2).

If we start with 3, ac doesn't align with ad in the first place.

Actually I just noticed that neither of 0, 1, 2, can start also because their first character won't align.
by AlgoStar (396 points)
selected by
0 votes
It may have a solution.

There are no sequences while searching with the length range of the considered sequences(e.g. when the length is 4). However, a solution may still exist. This means it was not found within the range of sequences considered. But this does not  prove that a solution does not exist.
by (132 points)

Related questions

The Book: Analysis and Design of Algorithms | Presentations on Slideshare | Lecture Notes, etc
...