Question:-https://practice.geeksforgeeks.org/problems/longest-palindrome-in-a-string/0#
Code:-
Please check where’s the error.
Question:-https://practice.geeksforgeeks.org/problems/longest-palindrome-in-a-string/0#
Code:-
Please check where’s the error.
hey @div_yanshu07 i have gone throw your code, can you tell me what have you done for lengths greater then 2 as it’s not getting cleared to me.
Consider a string “abba”. Now I will check if i and j are equal i.e. str[i]== str[j]. Now then dp[i+1][j-1] should be equalt to 1 that is it should be a plaindrome like in this case “bb” is a palindrome
have debugged your code here and know it’s giving correct output
Although test cases on gfg are quite strong and doesn’t get accepted as for
Input:
kjqlrzzfmlvyoshiktodnsjjp
Its Correct output can be:
zz and jj
but it’s accepting only
zz
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.