Here is the problem:
Suppose we have the following arrays:
[1,2,9]
[3,6,7]
[4,11]
[8,10,12]
The elements of the array are unique and ordered. The task is to find the shortest length of the sequence, which will contain at least one element of each array, but these elements must go one after another (without spaces, cannot be [1,3]), and also ordered. Therefore, in this case, the answer is:
5 => [7,8,9,10,11]
Is there an effective way to do this?
source
share