125. Valid Palindrome
题目:A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
翻译一下:就是有效回文串
思路:
首先将字符串中数字、字母提取出来,并且将所有字母转换为小写,存入新列表。
然后利用双指针解决问题
话不多说上代码
class Solution(object):def isPalindrome(self, s):""":type s: str:rtype: bool"""list=[]#convert numbers and characters and put them in a listfor charc in s:if charc.isalnum():list.append(charc.lower())#convert list to strings="".join(list)#Two-pointersleft = 0right = len(s)-1while left
over.