[프로그래머스] 튜플 (문자열, 정렬, python, javascript)
Posted by 해랑쓰 블로그 (Haerang's blog)
1. python 풀이 def solution(s): answer = [] temp=[] for i in s[2:-2].split('},{'): temp.append(i.split(',')) temp.sort(key=len) for t in temp: for item in t: if int(item) not in answer: answer.append(int(item)) return answer 2. javascript 풀이 function solution(s) { var answer = []; s=s.split("").map(ch=>{ if(ch==="{" || ch==="}"){ return ""; } return ch; }).join("").split(","); const dict={}; for(l..