Skip to content

Commit

Permalink
feat: TC, SC 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
gusdn0828 committed May 25, 2024
1 parent 14d1529 commit bddde12
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions counting-bits/saysimple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TC: O(n), SC: O(n)

class Solution:
def countBits(self, n: int) -> List[int]:
answer = []
Expand Down
2 changes: 2 additions & 0 deletions group-anagrams/saysimple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TC: O(n), SC: O(n)

from collections import defaultdict

class Solution:
Expand Down
2 changes: 2 additions & 0 deletions missing-number/saysimple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TC: O(n), SC: O(1)

class Solution:
def missingNumber(self, nums: List[int]) -> int:
for i in range(len(nums)+1):
Expand Down
2 changes: 2 additions & 0 deletions number-of-1-bits/saysimple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TC: O(1), SC: O(1)

class Solution:
def hammingWeight(self, n: int) -> int:
return bin(n).count("1")
2 changes: 2 additions & 0 deletions reverse-bits/saysimple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TC: O(1), SC: O(1)

class Solution:
def reverseBits(self, n: int) -> int:
return int(f"{bin(n)[2:]:0>32}"[::-1], 2)

0 comments on commit bddde12

Please sign in to comment.