mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Merge pull request #431 from EnzoSeason/leetcode-406
update 406 根据身高重建队列: 移除Pyhton版本的冗余代码
This commit is contained in:
@ -214,13 +214,10 @@ Python:
|
||||
```python
|
||||
class Solution:
|
||||
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
|
||||
people.sort(key=lambda x: (x[0], -x[1]), reverse=True)
|
||||
people.sort(key=lambda x: (-x[0], x[1]))
|
||||
que = []
|
||||
for p in people:
|
||||
if p[1] > len(que):
|
||||
que.append(p)
|
||||
else:
|
||||
que.insert(p[1], p)
|
||||
que.insert(p[1], p)
|
||||
return que
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user