Stuck in this dp problem ! pls help

Revision en1, by kkumar123, 2020-10-30 22:51:27

Question link

QUESTION - Given two strings, and , find and print the total number of ways to insert a character at any position in string such that the length of the Longest Common Subsequence of characters in the two strings increases by one.

n^2 approach acceptable

my approach to this question

Please , can anybody help me what's wrong in my code. I have commented it so that it is easy to understand. I think there is some recounting in my approach.

Tags #dynamic programing

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English kkumar123 2020-10-30 22:51:27 607 Initial revision (published)