public String longestPalindrome2(String s) {
        if (s == null || s.length() == 0) {
            return s;
        }
        mapping = new boolean[s.length()][s.length()];
        calculated = new boolean[s.length()][s.length()];

        for (int k = s.length() - 1; k >= 0; k--) {
            for (int i = 0; i < s.length() - k; i++) {
                int j = i + k;
                if (isPalindrome(s, i, j)) {
                    return s.substring(i, j + 1);
                }
            }
        }
        return null;
    }