Skip to content

Commit

Permalink
Apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdgua01 committed Aug 30, 2024
1 parent 23f01ba commit 5dd840e
Show file tree
Hide file tree
Showing 27 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion coding_test/leetcode/atoi32/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def myAtoi(self, str: str) -> int:

try:
answer = int(answer)
int32 = 2 ** 31
int32 = 2**31

if answer < -int32:
return -int32
Expand Down
2 changes: 1 addition & 1 deletion coding_test/leetcode/maximum_69_number/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def maximum_69_Number(self, num: int) -> str:
num = str(num)
for i, n in enumerate(num):
if n == "6":
num = f"{num[:i]}9{num[i+1:]}"
num = f"{num[:i]}9{num[i + 1:]}"
return num
return num
8 changes: 2 additions & 6 deletions coding_test/leetcode/median_of_two_sorted_arrays/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
max_left = (
max(nums1[i - 1], nums2[j - 1])
if i and j
else nums1[i - 1]
if i
else nums2[j - 1]
else nums1[i - 1] if i else nums2[j - 1]
)

if (m + n) % 2 == 1:
Expand All @@ -33,8 +31,6 @@ def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
min_right = (
min(nums1[i], nums2[j])
if i != m and j != n
else nums2[j]
if i == m
else nums1[i]
else nums2[j] if i == m else nums1[i]
)
return (max_left + min_right) / 2
2 changes: 1 addition & 1 deletion coding_test/leetcode/reverse_int/solution.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Solution:
def reverse(self, x: int) -> int:
int32 = 2 ** 31
int32 = 2**31
r = int(str(abs(x))[::-1])
if -int32 <= r < int32:
return -r if x < 0 else r
Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/brute_force/carpet/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42842
"""

from math import floor, sqrt
from typing import List

Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/brute_force/get_prime/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42839
"""

from itertools import permutations
from math import floor, sqrt

Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/brute_force/mock_exam/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42840
"""

from math import ceil
from typing import List

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42841
"""

from itertools import permutations
from typing import List

Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/dfs_bfs/network/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/43162
"""

from typing import List


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/dfs_bfs/target_number/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/43165
"""

from operator import add, sub
from typing import List

Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/dfs_bfs/travel/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/43164
"""

from typing import List


Expand Down
1 change: 0 additions & 1 deletion coding_test/programmers/hash/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
https://programmers.co.kr/learn/courses/30/lessons/42579
"""


from collections import defaultdict


Expand Down
1 change: 0 additions & 1 deletion coding_test/programmers/hash/spy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
https://programmers.co.kr/learn/courses/30/lessons/42578
"""


from collections import Counter
from functools import reduce

Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/heap/disk_controller/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42627
"""

from typing import List


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/heap/double_priority/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42628
"""

from typing import List


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/sort/biggest_number/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42746
"""

from typing import List, Tuple


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/sort/h_index/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42747
"""

from typing import List


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42586
"""

from collections import defaultdict


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/stack_queue/stock/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42584
"""

from collections import deque


Expand Down
1 change: 1 addition & 0 deletions coding_test/programmers/stack_queue/truck/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://programmers.co.kr/learn/courses/30/lessons/42583
"""

from collections import deque
from typing import Deque

Expand Down
1 change: 1 addition & 0 deletions data_structures/graph/adjacency_list/adjacency_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Simple adjacency list directed graph
"""

from collections import deque
from typing import Any, Deque, Union

Expand Down
1 change: 1 addition & 0 deletions data_structures/graph/adjacency_matrix/adjacency_matrix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Simple adjacency matrix undirected graph
"""

from collections import defaultdict, deque
from functools import reduce
from operator import iconcat
Expand Down
2 changes: 1 addition & 1 deletion data_structures/hash_table/quadratic_probing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def set(self, value: int, key=None, **kwargs) -> None:
self.set(value)
else:
coefficient = kwargs.get("coefficient", 0) + 1
self.set(value, key + (coefficient ** 2), coefficient=coefficient)
self.set(value, key + (coefficient**2), coefficient=coefficient)

@property
def keys(self):
Expand Down
1 change: 1 addition & 0 deletions sort/quick_sort/median_of_three.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
퀵 정렬의 최악의 경우를 피하는 방법
기준 요소를 평균값으로 결정하여 정렬한다.
"""

from typing import Any, List


Expand Down
1 change: 1 addition & 0 deletions sort/quick_sort/random_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
퀵 정렬의 최악의 경우를 피하는 방법
기준 요소를 랜덤으로 결정하여 정렬한다.
"""

import random
from typing import Any, List

Expand Down
1 change: 1 addition & 0 deletions sort/quick_sort/shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
퀵 정렬의 최악의 경우를 피하는 방법 중 하나
정렬 작업 전에 배열의 인덱스를 랜덤으로 섞어 주는 전처리 작업을 추가해서 최악의 경우를 피한다.
"""

import random
from typing import Any, List

Expand Down
1 change: 1 addition & 0 deletions sort/quick_sort/stack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
대용량의 데이터를 정렬하는데 부적합한 퀵 정렬을 개선
"""

from typing import Any, List


Expand Down

0 comments on commit 5dd840e

Please sign in to comment.