Whats wrong with this implementation…Please help me find a counter test case…

@admin @admin2 @vijju123 @raj79 @anmolmishra @ista2000
Question link :-

I have tried around 50 test cases in these 2.5 hours for 1<=N<=40 and your code gives correct answer on these.

While your code is working for the smaller test cases i run, your code fails miserably when N big, error starts from when N ~1000.

For N=2000, it printed a sequence of length 1014 which didnt even existed in 2nd string! Meaning, for that testcase the answer was 4, but your code gave a large answer of 1014. Its not possible to debug using a test case that large, so i am still trying to figure out a way to fail your code on a convenient test case.

But for debugging purposes, pay close attention to operations associated with second string, or how you are finding the LCS. The LCS your code finds is not existing in both strings (and hence isnt LCS).

Can you please indent your code properly, it’s really hard to understand :frowning:

Whats more important is can you give the question link?

Have a look now…

I tried a test case …using a long 2661 characters paragraph and searching for a small string…a long string of length 700…it passed them all …can u give me the exact test on which the code fails… @vijju123

Where should i send you? I dont think its good to paste 2 random 2000 char-long string in here XD.

Or, you can try generating a random string from that spoj test generator of 2000 length. I tried for 3 test and your code failed on all 3 by a large margin.