Skip to content

Commit 1f813d4

Browse files
committed
update 406 根据身高重建队列: 移除Pyhton版本的冗余代码
1 parent ab002e7 commit 1f813d4

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
class Solution:
216216
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
217-
people.sort(key=lambda x: (x[0], -x[1]), reverse=True)
217+
people.sort(key=lambda x: (-x[0], x[1]))
218218
que = []
219219
for p in 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)