标签:blog pre public tran -- bsp val end isa
class Solution { public: bool isPalindrome(string s) { transform(s.begin(), s.end(), s.begin(), ::tolower); int lt = 0, rt = s.size()-1; while(lt < s.size() && rt >= 0) { if(!isalnum(s[lt])) ++lt; else if(!isalnum(s[rt])) --rt; else if(s[lt] != s[rt]) return false; else { ++lt; --rt; } } return true; } };
标签:blog pre public tran -- bsp val end isa
原文地址:http://www.cnblogs.com/chengyuz/p/6741036.html