Merge pull request #155 from LiangDazhu/patch-10

添加 0406.根据身高重建队列 python版本
This commit is contained in:
Carl Sun
2021-05-17 15:55:17 +08:00
committed by GitHub

View File

@ -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