Clarification needed

why cant we do this:
find lcs for str1 & str2,
then find lcs from lcs(str1,str2) & str3

this should be better than o(n1n2n3) approach to consider 3d do array as the above logic would take O(n1n2 + n2n3) time and space?

also I applied the above logic and it is failing in 1test case


pls look into it.

@pradhumangupta99,
E.g,
sa=“abcde”
sb=“acebd”
sc=“bd”

Here lcs(sa,sb)=“ace”, lcs(lcs(sa,sb),sc)=""
But, lcs(sa,sb,sc)=“bd”