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.
2 parents 115b2b1 + 7866201 commit eb35585Copy full SHA for eb35585
number-of-1-bits/WHYjun.py
@@ -0,0 +1,7 @@
1
+class Solution:
2
+ def hammingWeight(self, n: int) -> int:
3
+ result = 0
4
+ for i in range(32):
5
+ if (n >> i) & 1:
6
+ result += 1
7
+ return result
valid-palindrome/WHYjun.py
@@ -0,0 +1,14 @@
+ def isPalindrome(self, s: str) -> bool:
+ s = [c.lower() for c in s if c.isalnum()]
+
+ if len(s) == 1:
+ return True
8
+ l, r = 0, len(s) - 1
9
+ while l < r:
10
+ if s[l] != s[r]:
11
+ return False
12
+ l += 1
13
+ r -= 1
14
0 commit comments