https://codeforces.com/contest/1447/problem/D
Can someone help in DP problem with memoization approach.
I tried this but this will not work for cases like a=“bab” and b=“bba”
int fun(int i, int j)
{
if(i==n || j==m)
return 0;
if(dp[i][j]!=-1)
return dp[i][j];
if(a[i]==b[j])
return dp[i][j]=2+fun(i+1,j+1);
return dp[i][j]=max({0, fun(i+1,j)-1, fun(i,j+1)-1});
}