We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
For instance if our string is "aabb"
then although there is no solution for a palindrome with only
one removal, for counter = 0 we find that:
'a' at index 0 != 'b' at index 3 and 'a' at index 0 != 'b' at index 2
therefore we return counter 0
but that solution would be abb, which is not a palindrome
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Palindrome Index
You are viewing a single comment's thread. Return to all comments →
For instance if our string is "aabb" then although there is no solution for a palindrome with only one removal, for counter = 0 we find that: 'a' at index 0 != 'b' at index 3 and 'a' at index 0 != 'b' at index 2 therefore we return counter 0 but that solution would be abb, which is not a palindrome