Haribo ML, AI, MATH, Algorithm

메뉴 리뉴얼


메뉴 리뉴얼

코드

from collections import Counter
from itertools import combinations
def solution(orders, course) :
    result = []
    for course_num in course :
        counter = Counter()
        for order in orders:
            counter += Counter(combinations(sorted(order), course_num))
        counter = counter.most_common()
        result.extend(''.join(key) for key, val in counter if val > 1 and val == counter[0][1])

    return sorted(result)


Similar Posts

이전 포스트 구명보트

다음 포스트 의상

Comments