Skip to content

Commit 09c241e

Browse files
committed
Add python solution code for leetcode No.9.
1 parent deea10f commit 09c241e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: leetcode-009/leetcode009.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def isPalindrome(self, x: int) -> bool:
3+
if x < 0:
4+
return False
5+
else:
6+
str0 = str(x)
7+
reversedStr = str0[::-1]
8+
if reversedStr == str0:
9+
return True
10+
return False
11+
12+
# Below is testing
13+
sol = Solution()
14+
print(sol.isPalindrome(616))

0 commit comments

Comments
 (0)