알고리즘

[프로그래머스] 두 개 뽑아서 더하기

HHB 2023. 10. 9. 19:03
def solution(numbers):
    answer = list()
    for i in range(len(numbers)):
        for j in range(i+1, len(numbers)):
            if numbers[i] + numbers[j] not in answer:
                answer.append(numbers[i] + numbers[j])
    answer.sort()
    return answer
728x90
반응형
LIST