리스트 정렬1 [프로그래머스] 완주하지 못한 선수 - 리스트 정렬, 해시 내가 짠 코드 def solution(participant, completion): if len(completion) == 0: return participant else: for c in completion: participant.remove(c) return participant[0] 나름 깔끔하다 생각했지만 for문으로 인해 효율성 점수가 0점이 나왔다... 리스트의 원소제거를 어떻게 하면 더 빨리 할 수 있을까? 어떻게 짜야 빨리 탐색할 수 있을까? 풀이방법들 1. collections 사용 from collections import Counter def solution(participant, completion): return list(Counter(participant) - Counter(co.. 2021. 4. 24. 이전 1 다음