[프로그래머스] 타겟 넘버 | 파이썬
Solution:def dfs(index, current_sum, numbers, target): # 모든 숫자를 탐색했을 때 if index == len(numbers): if current_sum == target: return 1 else: return 0 # 타겟과 같으면 1, 아니면 0 반환 # 다음 단계 탐색 count=0 count = count + dfs(index+1, current_sum+numbers[index], numbers, target) count = count + dfs(index+1, current_sum-numbers[index], numbers, target) r..
2025. 5. 22.