[Leetcode] Valid Palindrome
来源:互联网 发布:万人迷网络电话软件 编辑:程序博客网 时间:2024/04/30 04:49
class Solution {public: bool isPalindrome(string s) { int start=0; int end=s.size()-1; std::transform(s.begin(),s.end(),s.begin(),::tolower); while(start<end){ while(start<end&&!isAlph(s[start])) start++; while(start<end&&!isAlph(s[end])) end--; if(s[start]==s[end]){start++;end--;} else if(s[start]!=s[end]) return false; } if(start>=end) return true; else return false; } bool isAlph(char c){ if(c>='a'&&c<='z') return true; if(c>='0'&&c<='9') return true; }};
0 0
- [Leetcode] Valid Palindrome
- Leetcode: Valid Palindrome
- leetcode 55: Valid Palindrome
- [LeetCode] Valid Palindrome
- 【leetcode】Valid Palindrome
- LeetCode - Valid Palindrome
- [leetcode]Valid Palindrome
- [LeetCode]Valid Palindrome
- [Leetcode]Valid Palindrome
- LeetCode-Valid Palindrome
- [leetcode] Valid Palindrome
- LeetCode 125: Valid Palindrome
- LeetCode - Valid Palindrome
- leetcode之Valid Palindrome
- LeetCode | Valid Palindrome
- [leetcode]Valid Palindrome
- 【leetcode】Valid Palindrome
- LeetCode题解:Valid Palindrome
- 线程同步与通信
- [Leetcode] Same Tree
- DSP入门必看(上)
- 朴素的UNIX之-翻开历史
- 2、掌握变量定义的位置与时机
- [Leetcode] Valid Palindrome
- DSP入门必看(下)
- GNU C语言的 扩展(四)数组索引初始化&case标号连续范围
- struts 2标签之s:if 、s:iterator注意的问题
- 第一课课后作业------列表
- Ubuntu中文输入法的安装
- 我的词典:即粘即用一
- Android SpeechRecognizer语音识别
- [Leetcode] Combination Sum