【leetcode】】验证回文字符串 Ⅱ

bool validPalindrome(char * s){
    for (int i = 0, j = strlen(s)-1; i < j; ++i, --j) 
        if (s[i] != s[j]) 
            return (judge(s, i+1,j) || judge(s, i,j-1)); 
    return true;
}
int judge(char *str, int i, int j) {
    while (i < j) if (str[i++] != str[j--]) return false;
    return true;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13568769.html