Java: Given a string, find the longest palindromic contiguous substring.
Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of " aabcdcb " is " bcdcb ". The longest palindromic substring of "bananas" is " anana ". Approach Given String for example: “aabcdcb” - Let’s split problem in to smaller parts. - First lets chcek if the given String is valid or not if not, valid let’s return “ Invalid String ” response. - Next, we can write a helper method that checks if given String is palindrome or not (I used StringBuffer reverse method to check the String) - So, we have 2 utility methods lets concentrate on finding longest palindrome substring. (click on the image to expand) Note: · The above solution is not the ultimate or the only way to approach the problem. · ...