vector求最大值
// 使用 std::max_element 找到最大值的迭代器
auto max_it = std::max_element(vec.begin(), vec.end());
判断是否是数字字母
isalnum
tolower
toupper
class Solution {
public:
bool isPalindrome(string s) {
string newS;
for(char c:s){
if(isalnum(c)){
newS.push_back(tolower(c));
}
}
int len = newS.length();
int left=0, right=len-1;
while(left<right){
if(newS[left]==newS[right]){
left++;
right--;
}else{
break;
}
}
if(left>=right) return true;
else return false;
}
};