class Solution { public: bool palindrome2(string str, int left, int right) { /* 对删除元素后的字符串进行判断 因为前面已经判断了,所以多设置left和right两个参数 避免重复判断前面,导致耗时增加 */ while (left < right) { if (str[left] != str[right]) return false; left++; right--; } return true; } bool palindrome(string str) { // write code here /* 如...