Blog Archive

Monday, September 15, 2014

[leetcode]Valid Palindrome @ Python - 南郭子綦 - 博客园

[leetcode]Valid Palindrome @ Python - 南郭子綦 - 博客园: " if s == '':
return True
else:
sTmp = ''
for i in range(0, len(s)):
if s[i] >= 'a' and s[i] <= 'z' or s[i] >= '0' and s[i] <= '9' or s[i] >= 'A' and s[i] <= 'Z':
sTmp += s[i]
sTmp = sTmp.lower()
for i in range(0, len(sTmp)/2):
if sTmp[i] != sTmp[len(sTmp)-1-i]:
return False
return True"



'via Blog this'

No comments:

Post a Comment