• + 0 comments

    Maybe i'm missing something but trying the code from the editorial with:

    str1="ac", str2="abc" and it returns 1 but

    LCS(str1, str2) = 1 -------(a or c)

    The only way to increment LCS is to put a 'b' in str1 in the 2° position so:

    str1="ac"=========> str1="abc" and now LCS() = 3. In this case LCS is incermented by 2 not by 1 so there is not a way to increment the LCS by 1. So it should return 0.