标签:val color public col bool str help bsp ret
class Solution { public: bool validPalindrome(string s) { int i = 0, j = s.length() - 1; while (i < j) { if (s[i] == s[j]) { i++; j--; } else { return helper(s, i+1, j) || helper(s, i, j-1); } } return true; } bool helper(const string &s, int i, int j) { while (i < j) { if (s[i] != s[j]) return false; i++; j--; } return true; } };
标签:val color public col bool str help bsp ret
原文地址:https://www.cnblogs.com/JTechRoad/p/9123917.html