Leetcode 125. Valid Palindrome (Easy) (cpp)
来源:互联网 发布:如何做好淘宝 编辑:程序博客网 时间:2024/05/16 06:11
Leetcode 125. Valid Palindrome (Easy) (cpp)
Tag: Math
Difficulty: Easy
/*125. Valid Palindrome (Easy)Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palindrome.Note:Have you consider that the string might be empty? This is a good question to ask during an interview.For the purpose of this problem, we define empty string as valid palindrome.*/class Solution {public: bool isPalindrome(string s) { int left = 0, right = s.length() - 1; while (left < right) { while (!isalnum(s[left]) && left < right) left++; while (!isalnum(s[right]) && left < right) right--; if (tolower(s[left++]) != tolower(s[right--])) return false; } return true; }};
0 0
- Leetcode 125. Valid Palindrome (Easy) (cpp)
- Leetcode[Easy] - Valid Palindrome
- 【Easy】125. Valid Palindrome
- [Leetcode 125, easy] Valid Palindrome
- <LeetCode><Easy> 125 Valid Palindrome
- 125. Valid Palindrome [easy] (Python)
- Leetcode 9. Palindrome Number (Easy) (cpp)
- Leetcode 234. Palindrome Linked List (Easy) (cpp)
- Leetcode 409. Longest Palindrome (Easy) (cpp)
- Leetcode 266. Palindrome Permutation (Easy) (cpp)
- Leetcode OJ 125 Valid Palindrome [Easy]
- Leetcode 36. Valid Sudoku (Easy) (cpp)
- Leetcode 242. Valid Anagram (Easy) (cpp)
- Leetcode 20. Valid Parentheses (Easy) (cpp)
- leetcode 日经贴,Cpp code -Valid Palindrome
- [LeetCode]125.Valid Palindrome
- LeetCode 125. Valid Palindrome
- [Leetcode] 125. Valid Palindrome
- Leetcode 168. Excel Sheet Column Title (Easy) (cpp)
- html基础语法学习(1)
- hdu1008-电梯问题
- 8086汇编语言 段地址与偏移地址存在CS,IP寄存器中
- 8086汇编语言 转移指令是什么
- Leetcode 125. Valid Palindrome (Easy) (cpp)
- Chrome 开发工具之Timeline
- hdu4349xiaoming's hope(Lucas定理和位运算)
- LeetCode 101. Symmetric Tree
- jQuery基本选择器的使用
- JAVA 中BIO,NIO,AIO的理解
- 提取不重复的整数
- Android调用手机摄像头和相册获取图片
- 51 nod 1961 比大小