코딩테스트/구현|기타
[집합] 프로그래머스 튜플 Python
유(YOO)
2022. 2. 4. 11:01
https://programmers.co.kr/learn/courses/30/lessons/64065
def solution(s):
answer = []
temp = () # 튜플
s=s[2:-2].split('},{')
s.sort(key = lambda x:len(x))
for st in s:
t = set(list(map(int, st.split(','))))
answer += list(set.difference(t,temp)) # 차집합
temp = t
return answer