풀이 간단하게 풀이를 하려 하니 시간초과가 생겨서 딕셔너리를 사용하여 해결할 수 있도록 함. 그리고 dic의 값을 기준으로 정렬해서 키를 보여주는 건 sorted의 key를 dic.get으로 주니까 되는걸 알게 됨 def solution(players, callings): dic = {players[i]:i for i in range(len(players))} for i in callings: idx = dic[i] dic[i] -= 1 dic[players[idx-1]] += 1 players[idx],players[idx-1] = players[idx-1],players[idx] return sorted(dic,key=dic.get)