Longest common subsequence WA error

problem https://hack.codingblocks.com/contests/c/452/1267
code https://ide.codingblocks.com/#/s/15020

sample test (passes):
1
abcd1e2 bc12ea bd1ea

approach:
if lcs of 2 strings is “ss”
then lcs of 3 strings is (lcs of “ss” and 3rd string)

As you are starting the loop for dp from 1 so u have to compare a(i-1) and b(j-1) but you are comparing a(i) and b (j)
Fix this first !

1 Like