반응형
Notice
Recent Posts
Recent Comments
Link
목록reduce (1)
It's easy, if you try

문제 코딩테스트 연습 - 위장 programmers.co.kr 풀이 이 문제는 알고리즘 스터디에서 설원언니가 풀이해준 문제인데, 복습하면 좋을 것 같아 다시 풀어보며 공부한 후, 정리했다. from collections import Counter from functools import reduce def solution(clothes): count = Counter([category for name, category in clothes]) return reduce(lambda x, y : x * (y + 1), count.values(), 1) -1 먼저 서로 다른 의상의 조합의 수를 구하는 공식 clothes가 [[yellow_hat, headgear], [blue_sunglasses, eyewear]..
알고리즘/파이썬(Python)
2021. 2. 13. 09:40