| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 영어원서읽기
- 괜찮음
- 잡생각
- leetcode
- 개발자
- 만화도
- 10분
- 월간
- 파비최
- 매일
- 리얼 클래스
- Writing
- 화상영어
- 읽기
- Daily Challenge
- 링피트
- 스탭퍼
- English
- 사이드
- 30분
- 쓰릴오브파이트
- 프로젝트
- Problem Solving
- 영어공부
- 운동
- 미드시청
- 뭐든
- 3줄정리
- FIT XR
- realclass
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/queue-reconstruction-by-height/
Queue Reconstruction by Height - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
그냥 대 놓고 문제에 1번 idx로 정렬하고 그다음에 0번 idx로 정렬해서 출력하면 된다고 되어 있음.
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
res = []
people.sort(key=lambda x: (-x[0], x[1]))
for a in people:
res.insert(a[1], a)
return res반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2022.07.01 |
|---|---|
| Today's Challenge (0) | 2022.06.30 |
| Today's Challenge (0) | 2022.06.28 |
| Today's Challenge (0) | 2022.06.27 |
| Today's Challenge (0) | 2022.06.26 |
Comments