티스토리 뷰
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
def solution(s):
answer = []
s = s[2:-2]
s = s.split('},{')
s = sorted(s,key = lambda x: len(x))
for num in s:
num = num.split(',')
for n in num:
if int(n) not in answer:
answer.append(int(n))
return answer
'Algorithm > Programmers' 카테고리의 다른 글
| [프로그래머스] 오픈채팅방 - Python (0) | 2021.03.27 |
|---|---|
| [프로그래머스] 기능개발 - Python (0) | 2021.03.26 |
| [프로그래머스] 구명보트 - Python (0) | 2021.03.25 |
| [프로그래머스] 다리를 지나는 트럭 - Python (0) | 2021.03.25 |
| [프로그래머스] 주식가격 - Python (0) | 2021.03.25 |
