public int longestPalindromeSubstringEasy(char arr[]) {

        int longest_substring = 1;
        for (int i = 0; i < arr.length; i++) {

            int x, y;
            int palindrome;
            x = i;
            y = i + 1;
            palindrome = 0;
            while (x >= 0 && y < arr.length && arr[x] == arr[y]) {
                x--;
                y++;
                palindrome += 2;
            }
            longest_substring = Math.max(longest_substring, palindrome);
            
            x = i - 1;
            y = i + 1;
            palindrome = 1;
            while (x >= 0 && y < arr.length && arr[x] == arr[y]) {
                x--;
                y++;
                palindrome += 2;
            }
            longest_substring = Math.max(longest_substring, palindrome);
        }
        return longest_substring;
    }
Date 07/29/2015
@author Tushar Roy

Given a string find longest palindromic substring in this string.

References
http://www.geeksforgeeks.org/longest-palindrome-substring-set-1/
http://www.geeksforgeeks.org/longest-palindromic-substring-set-2/
http://articles.leetcode.com/2011/11/longest-palindromic-substring-part-ii.html
http://www.akalin.cx/longest-palindrome-linear-time
http://tarokuriyama.com/projects/palindrome2.php
src/com/interview/string/LongestPalindromeSubstring.java