Skip to content

Commit 8e85807

Browse files
committed
[level 2] Title: 타겟 넘버, Time: 850.25 ms, Memory: 98.6 MB -BaekjoonHub
1 parent 789c357 commit 8e85807

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

프로그래머스/2/43165. 타겟 넘버/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 성능 요약
66

7-
메모리: 98.9 MB, 시간: 677.63 ms
7+
메모리: 98.6 MB, 시간: 850.25 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2025년 04월 26일 16:15:56
19+
2025년 12월 28일 17:04:35
2020

2121
### 문제 설명
2222

프로그래머스/2/43165. 타겟 넘버/타겟 넘버.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22

33
def solution(numbers, target):
44
cnt = 0
5-
5+
66
q = deque([(0, numbers[0]), (0, -numbers[0])])
7-
87
while q:
98
i, total = q.popleft()
10-
11-
if total == target and i == len(numbers) - 1:
9+
10+
if i == len(numbers)-1 and total == target:
1211
cnt += 1
13-
1412
if i+1 < len(numbers):
1513
q.append((i+1, total + numbers[i+1]))
1614
q.append((i+1, total - numbers[i+1]))
17-
18-
return cnt
19-
15+
16+
return cnt

0 commit comments

Comments
 (0)