Skip to content

Commit c528fd2

Browse files
committed
change time complexity of algorythm to O(log n)
1 parent 891ee93 commit c528fd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

number-of-1-bits/samthekorean.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# TC : O(n)
1+
# TC : O(log n)
2+
# reason : bin method internally devides n by 2 while transitioning to binary number
23
# SC : O(1)
34
class Solution:
45
def hammingWeight(self, n: int) -> int:

0 commit comments

Comments
 (0)