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