@@ -0,0 +1,1087 @@
+/**%0A * Created by gungr on 10/11/2016.%0A */%0Apublic class LongestPalindromeSubstring %7B%0A%0A%09// LeetCode 5 %0A    public static String longestPalindrome(String s) %7B%0A        int start = 0;%0A        int end = 0;%0A        for(int i = 0; i %3C s.length(); i++) %7B%0A            int even = expandFromCentre(s, i, i+1);%0A            int odd = expandFromCentre(s, i, i);%0A            int len = Math.max(even, odd);%0A            if(len %3E end - start) %7B%0A                start = i - (len-1) / 2;%0A                end = i + len / 2;%0A            %7D%0A        %7D%0A        return s.substring(start, end + 1);%0A    %7D%0A%0A    private static int expandFromCentre(String s, int left, int right) %7B%0A        int start = left;%0A        int end = right;%0A        while(start %3E= 0 && end %3C s.length() && s.charAt(start) == s.charAt(end)) %7B%0A            start--;%0A            end++;%0A        %7D%0A        return end - start - 1;%0A    %7D%0A%0A    public static void main(String%5B%5D argv) %7B%0A//        String s = %22cbaaabcee%22;%0A        String s = %22bb%22;%0A        System.out.println(longestPalindrome(s));%0A%0A//        System.out.println(s.substring(0, 4));%0A    %7D%0A%7D%0A

longest palindrome substring LeetCode 5