python-algorithm
leetcode 9. Palindrome Number
무적김두칠
2023. 6. 26. 14:04
Palindrome Number - LeetCode
Can you solve this real interview question? Palindrome Number - Given an integer x, return true if x is a palindrome, and false otherwise. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Ex
leetcode.com
1
2
3
4
5
6
|
class Solution:
def isPalindrome(self, x: int) -> bool:
if str(x) == str(x)[::-1]:
return True
else:
return False
|
cs |
반응형