Palindrome Index

  • + 10 comments

    The best way to solve this problem is by looking at it from both ends just like you would while checking for the string being a palindrome. When an inequality occurs, ->skip the right element and check the middle portion of the string including the left element if it's a palindrome. ->if a palindrome index of right element should be skipped ->else index of left element should be skipped If no inequaliry occured then return -1.