检测效率较低,思路就是 找到俩个字母相同的索引,根据他们的索引判断是否为回文: public int getLongestPalindrome(String A, int n) { int result = 1; char chars[] = A.toCharArray(); for(int i = 0;i < chars.length;i++){ for(int j = 0;j < i;j++){ if(chars[i] == chars[j] && i - j+1 > result && checkPali(chars,j,i)){ res...