-
문자열 내 마음대로 정렬하기프로그래밍/알고리즘 2021. 4. 2. 14:24
나의 풀이
def solution(strings, n): return sorted(sorted(strings), key=lambda x: x[n]) # return sorted(strings, key=lambda x: x[n]+x[:]) # 이 방법도 있음.
다른 사람 풀이
def strange_sort(strings, n): def sortkey(x): return x[n] strings.sort(key=sortkey) return strings
728x90반응형LIST'프로그래밍 > 알고리즘' 카테고리의 다른 글
이상한 문자 만들기 (0) 2021.04.02 나누어 떨어지는 숫자배열 (0) 2021.04.02 체육복 (0) 2021.03.31 124 나라의 숫자 (0) 2021.03.30 프린터 (0) 2021.03.30