classSolution { private: boolfind_diff(conststring& s, int& left, int& right) { while (left < right) { if (s[left] != s[right]) { returntrue; } left++; right--; } returnfalse; } public: boolvalidPalindrome(string s){ int left = 0; int right = s.size() - 1;
while (left < right) { if (find_diff(s, left, right)) { int temp_left = left + 1; int temp_right = right; if (!find_diff(s, temp_left, temp_right)) { returntrue; }