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 cd5f9f7 commit 12d35cbCopy full SHA for 12d35cb
number-of-1-bits/i-mprovising.py
@@ -0,0 +1,9 @@
1
+"""
2
+Time complexity O(n)
3
+Space complexity O(1)
4
5
+
6
+class Solution:
7
+ def hammingWeight(self, n: int) -> int:
8
+ return bin(n).count('1')
9
valid-palindrome/i-mprovising.py
@@ -0,0 +1,13 @@
+Space complexity O(n)
+ def isPalindrome(self, s: str) -> bool:
+ # preprocessing
+ string = [c for c in s.lower() if c.isalnum()]
10
11
+ if string == [c for c in string[::-1]]:
12
+ return True
13
+ return False
0 commit comments