일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- coding
- python
- lv4
- import re
- counter
- 조합
- 코딩
- Level2
- BFS
- mysql
- 코딩테스트
- sql
- 완전탐색
- CodingTest
- 파이썬
- programmers
- lambda
- 데이터분석
- Queue
- level4
- collections
- coding test
- 코테
- itertools
- Stack
- 시간복잡도
- join
- 프로그래머스
- 연습문제
- time complexity
- 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