Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite23b6a1

Browse files
Merge pull requestyoungyangyang04#431 from EnzoSeason/leetcode-406
update 406 根据身高重建队列: 移除Pyhton版本的冗余代码
2 parentse719e4f +1f813d4 commite23b6a1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎problems/0406.根据身高重建队列.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,10 @@ Python:
214214
```python
215215
classSolution:
216216
defreconstructQueue(self,people: List[List[int]]) -> List[List[int]]:
217-
people.sort(key=lambdax: (x[0],-x[1]),reverse=True)
217+
people.sort(key=lambdax: (-x[0], x[1]))
218218
que= []
219219
for pin people:
220-
if p[1]>len(que):
221-
que.append(p)
222-
else:
223-
que.insert(p[1], p)
220+
que.insert(p[1], p)
224221
return que
225222
```
226223

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp