https://www.codetree.ai/missions/8/problems/most-frequent-data/description
코드트리 | 코딩테스트 준비를 위한 알고리즘 정석
국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.
www.codetree.ai
import sys
from collections import defaultdict
from collections import Counter
input = sys.stdin.readline
n = int(input())
# 1. defaultdict
# dic = defaultdict(int)
# for _ in range(n):
# s = input().rstrip()
# dic[s] += 1
# print(max(dic.values()))
# 2. Counter
s_list = []
for _ in range(n):
s_list.append(input().rstrip())
counter = Counter(s_list)
print(max(counter.values()))
728x90
반응형
'🔻PS > Codetree' 카테고리의 다른 글
[Codetree] 큰 숫자만 계속 고르기 Python (0) | 2024.08.09 |
---|---|
[Codetree] 정수 명령 처리 6 Python (0) | 2024.08.09 |
[Codetree] 가장 먼저 나오는 숫자 Python (0) | 2024.08.08 |
[Codetree] 가장 먼저 나오는 숫자 Python (0) | 2024.08.08 |
[Codetree] 가장 먼저 나오는 숫자 Python (0) | 2024.08.08 |