728x90
from collections import Counter
def solution(participant, completion):
answer = '';
c1 = Counter(participant);
c2 = Counter(completion);
for i in c1 :
if c1[i] != c2[i] :
return i;
return answer
풀이 및 회고
Counter 를 사용해서 문제를 풀었습니다. 해쉬 구조를 이용한 풀이를 할땐 Counter 를 사용해야겠다고 생각했습니다.
728x90
'프로그래머스' 카테고리의 다른 글
프로그래머스 LV2 [3차] 압축 (0) | 2024.06.17 |
---|---|
프로그래머스 LV2 전화번호 목록 (0) | 2024.06.15 |
프로그래머스 LV2 타겟넘버 (1) | 2024.06.02 |
프로그래머스 LV2 피로도 (0) | 2024.06.01 |
프로그래머스 LV2 프로세스 (0) | 2024.06.01 |