일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- sql
- Stack
- 프로그래머스
- itertools
- Queue
- 시간복잡도
- coding test
- 연습문제
- 코테
- collections
- counter
- coding
- 조합
- level4
- 완전탐색
- 파이썬
- join
- cte
- lv4
- 데이터분석
- time complexity
- Level2
- programmers
- mysql
- 코딩
- import re
- 코딩테스트
- lambda
- python
- BFS
- Today
- Total
목록12915번 (1)
ror_coding
[Programmers] 문자열 내 마음대로 정렬하기 - 12915
lambda를 이용해 특정 인덱스를 기준으로 문자열 정렬하기 !lambda는 너무 어색해~ㅠㅠ Question 문자열로 구성된 리스트 strings와, 정수 n이 주어졌을 때, 각 문자열의 인덱스 n번째 글자를 기준으로 오름차순 정렬하려 합니다. 예를 들어 strings가 ["sun", "bed", "car"]이고 n이 1이면 각 단어의 인덱스 1의 문자 "u", "e", "a"로 strings를 정렬합니다. Code def solution(strings, n): return sorted(strings, key = lambda x:(x[n],x) ) now meOn my github
Algorithm/Python
2024. 10. 12. 10:59