I am trying to solve a dp question from prepbytes and problem statment in simple words is as following:-
We are given 3 strings s1,s2,s3, we have to find longest common subsequence of s1 and s2 which does not contain s3 as its substring.
In my approach , I tried to maintain current positions of s1 and s2, and the length of s3 that is matched in our common subsequence till now. The transitions are almost like the longest common subsequence problem. Then I tried to retrace to find the longest common subsequence. I am not able to figure out what is wrong with my code. Can anyone please help me in finding where I am going wrong.
Link to my code :- Link
Thanks in advance!!
UPD:- Found same problem on codeforces and submitted the same code mentioned above and it got accepted!!