Skip to content

Commit f8cf103

Browse files
Create 9. Palindrome Number.py
1 parent e4fc0e9 commit f8cf103

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/easy/9. Palindrome Number.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def isPalindrome(self, x: int) -> bool:
3+
str_forward = str(x)
4+
str_backward = str_forward[::-1]
5+
return str_forward == str_backward

0 commit comments

Comments
 (0)