import re
def solution(files):
answer = []
filelist = list()
for idx, file in enumerate(files):
numberloc = re.search("[0-9]+", file).span()
head = file[:numberloc[0]]
number = int(file[numberloc[0]:numberloc[1]])
tail = file[numberloc[1]:]
filelist.append([idx, head.lower(), number])
filelist.sort(key = lambda k : (k[1], k[2]), reverse = False)
answer = [files[_[0]] for _ in filelist]
return answer
'알고리즘' 카테고리의 다른 글
programmers 예산 (0) | 2019.09.09 |
---|---|
2018 kakao blind recruitment 길 찾기 게임 (0) | 2019.09.09 |
2017 kakao blind recruitment 3차 자동완성 (0) | 2019.09.06 |
2017 kakao blind recruitment 3차 압축 (0) | 2019.09.05 |
2017 kakao blind recruitment 3차 방금그곡 (0) | 2019.09.05 |