Print LCS time limit

I tried many ways to avoid TLE, but each time I am getting TLE in first test case and correct answer in second case. Please suggest how to do.

save your code on ide.codingblocks.com and share the link here…
i hope you are using bottom up approach

I saved all subsequences in arraylists and finding common elements.

no that approach will definitely give tle you need to use bottom up dp to solve this ques

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.