Code giving runtime error

Aryan, the approach you were using for printing was wrong, I have made some corrections in your code, plz refer to this edited code,
also I have used the printing logic in the lcs dp function only,

1 Like

thanks , i got the mistake now

@yuktimutreja01 its still giving wrong answer in 1 testcase

I have used char array, instead of string, now it is working correctly,
Try to submit the code now,