We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 772a64e commit 905436eCopy full SHA for 905436e
Python/isPalindrome.py
@@ -1,12 +1,17 @@
1
+#Name: Abdullah Yaqub
2
+#Username: AbdullahYaqub72
3
+#Approach: Comparing arrays while traversing in forward and reverse order
4
+
5
class Solution:
- def isPalindrome(self, x: int) -> bool:
- flag=True
- y=str(x)
- for i in range(0,len(y)-1):
6
+ def isPalindrome(self, num: int) -> bool:
7
+ isPalind=True
8
+ y=str(num)
9
+ for i in range(len(y)-1):
10
ind=len(y)-i-1
- if(y[i]==y[ind]):
- else:
- flag=False
11
+ if(y[i]!=y[ind]):
12
+ isPalind=False
13
break
- return flag
14
+ else:
15
16
17
+ return isPalind
0 commit comments