반응형
from collections import Counter
def solution(topping):
answer = 0
A = set()
B = Counter(topping)
for i in topping:
B[i] -= 1
A.add(i)
if B[i] == 0:
B.pop(i)
if len(B) == len(A):
answer += 1
return
반응형
'알고리즘' 카테고리의 다른 글
[파이썬🐍] 프로그래머스 : 순위 검색 (0) | 2023.01.11 |
---|---|
[파이썬🐍] 프로그래머스 : 부대복귀 (0) | 2023.01.11 |
[파이썬🐍] 프로그래머스 : 다단계 칫솔 판매 (0) | 2023.01.10 |
[파이썬🐍] 프로그래머스 : 기지국 설치 (0) | 2023.01.10 |
[파이썬🐍] 프로그래머스 : 귤 고르기 (0) | 2023.01.10 |
댓글