Not able to get logic

Hello…
I am doing this question from hackerearth… with DP tag…

I know how to find the longest palindromic subsequence…
This could be a variation question of that… but i am not getting any idea on this…

As this question doesn’t have any editorial … so i asked the doubt…
Please see this…
Thanks…

Hey @ashishnnnnn
for every pair of c’s find lps in inner portion and outer portion
like
bbcabacbd
So for every c c pair
find lps in inner until i second c index keep start i=0 and j =str.length()
and
find lps inside i.e start from i=first c index and j= second c index
cabac here 5

Also assume every c to be centre of lps
And find even lps in remaining
in above
bbabacbd find lps here until i< c index and j > c index keep start i=0 and j =str.length()
bbcababd find lps here until i< c index and j > c index keep start i=0 and j =str.length()

According to me this should be the approach

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.