The first array yielded from lcs is sometimes 4 elements long and has 0 length. The 4-element arrays aren't terrible, I suppose, because the values at index 0/1/2 have the same meaning as they would in a 3-element array. But AFAIK zero-length common substrings are meaningless in the LCS and should be left out.
In my testing it seems like this always occurs unless the inputs have a common prefix.
The first array yielded from
lcs
is sometimes 4 elements long and has 0 length. The 4-element arrays aren't terrible, I suppose, because the values at index 0/1/2 have the same meaning as they would in a 3-element array. But AFAIK zero-length common substrings are meaningless in the LCS and should be left out. In my testing it seems like this always occurs unless the inputs have a common prefix.Some examples: