반응형
def solution(participant, completion):
participant_sort = sorted(participant)
completion_sort = sorted(completion)
result = ""
for idx in range(len(participant_sort)):
if idx < len(completion_sort):
if participant_sort[idx] != completion_sort[idx]:
result = participant_sort[idx]
break
else:
pass
else:
result = participant_sort[len(participant_sort) - 1]
pass
return result
def solution(participant, completion):
participant_sort = sorted(participant)
completion_sort = sorted(completion)
for idx in range(len(completion_sort)):
if participant_sort[idx] != completion_sort[idx]:
return participant_sort[idx]
return participant_sort[len(participant_sort) - 1]반응형
'삽집하는 개발들 > 알고리즘' 카테고리의 다른 글
| [19일차][프로그래머스][133499]옹알이(2) (0) | 2023.07.08 |
|---|---|
| [18일차][프로그래머스][42862]체육복 (0) | 2023.07.06 |
| [17일차][프로그래머스][140108]문자열 나누기 (0) | 2023.07.04 |
| [16일차][프로그래머스][2019 카카오 - 64061]크레인 인형뽑기 게임 (0) | 2023.07.03 |
| [15일차][프로그래머스][2020 카카오 - 67256]키패드 누르기 (0) | 2023.06.29 |