Longest common subsequnce | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Longest common subsequnce

Please refer code below: https://code.sololearn.com/cA45A22a19a2/#cpp I am wondering why we are comparing from last character as equal or not? We could have compared like first character is matching or not.

14th Jun 2021, 5:28 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer
+ 1
comparing first char involves more complexity: the base case should test for end of strings reached, and the recursion should use different stribg start positions at each call ^^
14th Jun 2021, 6:37 PM
visph
visph - avatar