Where am I going wrong in this top down approach
Hi @akh.chakraborty11
I can find two mistakes in your code.
- Line 4 … if(i>j) you should return true instead of false. Try to think with example of “abba”.
- Line 9 … isPalindrome(str,n,i+1,j-1,dp);
You are not updating ans.
Rest everything is fine.
Have a look i have marked your mistakes.
Mark the thread Resolved if so