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 938bce8 commit e06a675Copy full SHA for e06a675
1 file changed
two-sum/gyeo-ri.py
@@ -1,3 +1,17 @@
1
+"""
2
+[결과 요약]
3
+# 재시도횟수: 3회
4
+ 1. 배열의 모든 경우의 수 계산하기
5
+ - 시간복잡도 O(n^2)
6
+ 2. 전체 반복하지 않고 인덱스 기준 뒤만 반복하기
7
+ - O(n^2)이지만 약간 더 효율적
8
+ 3. 딕셔너리(Map) 사용
9
+ - 시간복잡도: O(n) / 공간복잡도: O(n)
10
+ - 딕셔너리 자체는 빨리 떠올렸으나 Key 중복이 될 수 있다고 잘못 판단하여 시간을 오래 소모
11
+ - 실제로 하나의 숫자는 최대 두 번까지 사용되어 구조 상 Key가 중복되지 않음
12
13
+
14
15
class Solution:
16
def twoSum(self, nums: list[int], target: int) -> list[int]:
17
nums_dict = {}
0 commit comments