mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-10 04:06:51 +08:00
Update 0406.根据身高重建队列.md
Added python version code
This commit is contained in:
@ -211,7 +211,18 @@ class Solution {
|
||||
```
|
||||
|
||||
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)
|
||||
que = []
|
||||
for p in people:
|
||||
if p[1] > len(que):
|
||||
que.append(p)
|
||||
else:
|
||||
que.insert(p[1], p)
|
||||
return que
|
||||
```
|
||||
|
||||
Go:
|
||||
|
||||
|
Reference in New Issue
Block a user