반응형
def solution(numbers, target):
temp = []
tempList = []
for n in numbers:
if len(temp) == 0:
temp.append(+n)
temp.append(-n)
else:
for t in temp:
tempList.append(t+n)
tempList.append(t-n)
temp = list(tempList)
tempList = []
answer = temp.count(target)
return answer
반응형
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[파이썬][프로그래머스] 동적계획법(Dynamic Programming) 정수 삼각형 (0) | 2023.01.03 |
---|---|
[파이썬][프로그래머스] 탐욕법(Greedy) 구명보트 (0) | 2022.12.19 |
[파이썬][프로그래머스] 탐욕법(Greedy) 체육복 (0) | 2022.12.02 |
[파이썬][프로그래머스] 완전탐색 피로도 (0) | 2022.11.29 |
[파이썬][프로그래머스] 완전탐색 카펫 (0) | 2022.11.28 |
댓글