Longest palindromic substring


can u plz tell me how to print substring in both top down or bottom up approch
it is easy to find max length of palindrome but how to print it??

hello @Ashu1318

while applying ur technique u can keep track of two additional things.
a starting index of maximum length string and the length itself.

for code refer this->link

actually bottom up approch is quite confusing , can we do it by top down , length would be cal easily but how can we store starting index ??

in top down its not possible to get string while calculating lps.

u can do this->
first prepare dp table using top down approach . and then use that table to get string

okay okay now i got it ,also i want to know is it imp to know the bottom up approch as well in gernal bcz top down is simply recursive and memoization which is simple as compare to bottom up

yeah top down is easy but u should know bottom up as well