dfs1 [프로그래머스/Lv.2] 타겟 넘버 1) DFS함수를 numbers 크기만큼 재귀한다. 이때 총 합이 target과 동일하면 answer을 카운팅 후 numbers 크기만큼 재귀했다면 재귀를 종료한다.2) DFS를 호출 할 때 마다 index값을 올려준다. '-' or '+' 연산을 수행한다. (반복) class Solution { int arr[]; int targetNum, answer; int arrLength; public int solution(int[] numbers, int target) { answer = 0; targetNum = target; arrLength = numbers.length; arr = new int[arrLength].. 2025. 2. 13. 이전 1 다음