Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09c241e

Browse files
committed
Add python solution code for leetcode No.9.
1 parentdeea10f commit09c241e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎leetcode-009/leetcode009.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
classSolution:
2+
defisPalindrome(self,x:int)->bool:
3+
ifx<0:
4+
returnFalse
5+
else:
6+
str0=str(x)
7+
reversedStr=str0[::-1]
8+
ifreversedStr==str0:
9+
returnTrue
10+
returnFalse
11+
12+
# Below is testing
13+
sol=Solution()
14+
print(sol.isPalindrome(616))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp