LeetCode p125 Valid Palindrome 题解
1.题目:
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.
题意:
只考虑数字和字母,判断一个字符串是否回文。
2.解题思路:
见代码,从两头往中间找。
3.代码
1 |
|