ji-0630 / CodingTest

코딩테스트 연습 기록
0 stars 0 forks source link

삼총사 #233

Open ji-0630 opened 1 year ago

ji-0630 commented 1 year ago

문제 설명

image

ji-0630 commented 1 year ago

다른 사람의 풀이

from itertools import combinations

def solution(number):
    ans = 0

    for i in combinations(number,3):
        if sum(i) == 0:
            ans += 1

    return ans

nums = [1,2,3,4] combi = list(combinations(nums, 2))