what is wrong with this code even though it is of o(n) time complexity i get tle??please point out errors in this code only
TLE ERROR https://practice.geeksforgeeks.org/problems/longest-consecutive-subsequence/0/?track=sp-hashing&batchId=152
Hello. It would be even better if you use recursive approach with dynamic programming. Check for the first element in each string first. If equal, move ahead(by one position in both the stings). Otherwise move string ahead by one step and call the function again, similarly do this for the other string at the same time. After every step, return the max length.
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.