DOSA - Lalith Dosa

I am getting WA please help i have given explained algo too

qstn

solution:

algo used

for finding lcs in o(nlogn) i used this link