[python] 타겟 넘버
문제 출처 타겟 넘버 풀이 풀이 1 def dfs(idx, numbers, result, target): global answer if idx == len(numbers): if result == target: answer += 1 return dfs(idx+1, numbers, result+numbers[idx], target) dfs(idx+1,numbers, result-numbers[idx], target) answer = 0 def solution(numbers, target): dfs(0, numbers, 0, target) return answer 풀이 2 def solution(numbers, target): if not numbers: if target: return 0 return 1 ..
2019. 9. 1.