Skip to content

Commit d4dbdae

Browse files
committed
Fix formatting
1 parent c540da7 commit d4dbdae

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

counting-bits/bhyun-kim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
from typing import List
2121

22+
2223
class Solution:
2324
def countBits(self, n: int) -> List[int]:
24-
2525
output = []
26-
for i in range(n+1):
26+
for i in range(n + 1):
2727
_str = str(bin(i))[2:]
2828
_sum = sum(map(int, _str.strip()))
2929
output.append(_sum)
3030

31-
return output
31+
return output

group-anagrams/bhyun-kim.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,18 @@
2626

2727
from typing import List
2828

29+
2930
class Solution:
3031
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
31-
3232
hash_table = []
3333
counters = []
3434
for s in strs:
35-
36-
count_s = ''.join(sorted(s))
35+
count_s = "".join(sorted(s))
3736
if count_s in hash_table:
3837
idx = hash_table.index(count_s)
3938
counters[idx].append(s)
4039
else:
4140
hash_table.append(count_s)
4241
counters.append([s])
43-
42+
4443
return counters

missing-number/bhyun-kim.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
"""
1919
from typing import List
2020

21+
2122
class Solution:
2223
def missingNumber(self, nums: List[int]) -> int:
23-
2424
nums.sort()
2525
for i in range(len(nums)):
2626
if i != nums[i]:
2727
return i
2828

2929
return len(nums)
30-

number-of-1-bits/bhyun-kim.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
- No extra space is used
1717
"""
1818

19+
1920
class Solution:
2021
def hammingWeight(self, n: int) -> int:
2122
output = 0
2223

2324
i = 1 << 31
24-
while(i > 0) :
25-
26-
if((n & i) != 0) :
25+
while i > 0:
26+
if (n & i) != 0:
2727
output += 1
28-
28+
2929
i = i // 2
3030

31-
return output
31+
return output

reverse-bits/bhyun-kim.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
1919
"""
2020

21+
2122
class Solution:
2223
def reverseBits(self, n: int) -> int:
2324
n_bin = bin(n)[2:].zfill(32)
24-
n_bin = ''.join(reversed(n_bin))
25-
return int(n_bin, base=2)
25+
n_bin = "".join(reversed(n_bin))
26+
return int(n_bin, base=2)

0 commit comments

Comments
 (0)