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

 

相关文章:

  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2021-06-22
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-11-17
相关资源
相似解决方案