class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
x=str(x)
i=0
j=len(x)-1
while i < j:
if x[i] != x[j]:
return False
i+=1
j-=1
return True
相关文章
- 01-07[leetcode]Partition List @ Python
- 01-07leetcode:Palindrome Linked List
- 01-07[LeetCode&Python] Problem 122. Best Time to Buy and Sell Stock II
- 01-07Leetcode_202_Happy Number
- 01-07leetcode String to Integer (atoi) python
- 01-07Leetcode 200. number of Islands
- 01-07[leetcode]Multiply Strings @ Python
- 01-07[LeetCode]题解(python):057-Insert Interval
- 01-07有趣的数-回文数(Palindrome number)
- 01-07Leetcode 之 Valid Triangle Number