9. Palindrome Number(判断整型数字是否是回文,直接暴力即可)

Determine whether an integer is a palindrome. Do this without extra space.

 

 

 1 class Solution:
 2     def isPalindrome(self, x):
 3         """
 4         :type x: int
 5         :rtype: bool
 6         """
 7         x =str(x)
 8 
 9 
10         for i in range(int(len(x)/2)+1):
11             if(x[i]!=x[len(x)-i-1]):
12                 return False
13     
14         return True

 

posted @ 2018-02-18 15:26  乐乐章  阅读(157)  评论(0编辑  收藏  举报