125. Valid Palindrome
来源:互联网 发布:开淘宝店怎么代理货源 编辑:程序博客网 时间:2024/06/05 18:30
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.
Subscribe to see which companies asked this question
class Solution {public: bool isPalindrome(string s) { string temp=""; for(int i=0;i<s.size();++i) { if((s[i]>='a')&&(s[i]<='z')||(s[i]>='A')&&(s[i]<='Z')||(s[i]>='0')&&(s[i]<='9')) { if((s[i]>='A')&&(s[i]<='Z')) { temp+=('z'-('Z'-s[i])); } else temp+=s[i]; } } return temp==string(temp.rbegin(),temp.rend()); }};
0 0
- [LeetCode]125.Valid Palindrome
- LeetCode 125. Valid Palindrome
- [Leetcode] 125. Valid Palindrome
- 【LeetCode】125.Valid Palindrome
- [leetcode] 125.Valid Palindrome
- 125. Valid Palindrome
- [leetcode] 125.Valid Palindrome
- Leetcode 125. Valid Palindrome
- 125. Valid Palindrome
- 125. Valid Palindrome LeetCode
- 125. Valid Palindrome
- 【LeetCode】125. Valid Palindrome
- 125. Valid Palindrome
- 125. Valid Palindrome
- Leetcode 125. Valid Palindrome
- LeetCode 125. Valid Palindrome
- LeetCode 125. Valid Palindrome
- LeetCode *** 125. Valid Palindrome
- Android中Application类用法
- C++,C,java面试例题
- spark一个版本问题引发的血案(java.lang.NoSuchMethodError: org.apache.spark.ui.SparkUI.addStaticHandler)
- 新生练习3
- Codeforces Round #325 (Div. 2) D bfs
- 125. Valid Palindrome
- PE文件详解之区块表
- 华为机试题【9】-整数分割为2的幂次
- 我对CONTAINING_RECORD宏的详细解释
- hdu 5178(尺取法)
- <React Native> 学习日记(1) 成功运行、编译RN-android的爬坑记录
- web开发的一些小经验
- 离散傅里叶(DFT) 与 快速傅里叶(FFT)
- A. Mike and Cellphone(cf#361)