[9/11] 타겟 넘버 (x)

이경준·2021년 9월 11일
0

코테

목록 보기
101/140

레벨2 문제 실패

코드

def solution(numbers, target):
    
    leaves = [0]

    for num in numbers:

        temp = []
        for parent in leaves:
            temp.append( parent + num )
            temp.append( parent - num )
        leaves = temp

    answer = leaves.count(target)
    
    return answer

로직

  • bfs
profile
The Show Must Go On

0개의 댓글