LeetCode-326-验证字符串是否是回文
发布时间
阅读量:
阅读量

策略一:筛选机制结合逆向判定法
class Solution
{
public:
bool isPalindrome(string s)
{
string tmp;
for (auto& x : s)
{
if (isalnum(x))
{
tmp += tolower(x);
}
}
string tmp_tmp(tmp.rbegin(), tmp.rend());
return tmp_tmp == tmp;
}
};
int main()
{
Solution A;
cout << A.isPalindrome("") << endl;
return 0;
}
全部评论 (0)
还没有任何评论哟~
