Problem Solving/📕Programmers
[Programmers] 튜플 (Python)
📖 문제 https://programmers.co.kr/learn/courses/30/lessons/64065 코딩테스트 연습 - 튜플 "{{2},{2,1},{2,1,3},{2,1,3,4}}" [2, 1, 3, 4] "{{1,2,3},{2,1},{1,2,4,3},{2}}" [2, 1, 3, 4] "{{4,2,3},{3},{2,3,4,1},{2,3}}" [3, 2, 4, 1] programmers.co.kr 💻 코드 from collections import defaultdict def solution(s): d = defaultdict(int) for n in s.replace('{', '').replace('}', '').split(','): d[int(n)] += 1 return [item[0] fo..
2021. 10. 9. 12:13