打卡题目:leetcode第406题,根据身高重建队列
    相似题目:435
    image.png


    【代码】

    1. class Solution:
    2. def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
    3. # 排序
    4. people = sorted(people, key=lambda x: (-x[0], x[1]))
    5. # “插入排序”, k相同时,h小的在前面
    6. for i, (h, k) in enumerate(people):
    7. people.insert(k, people.pop(i))
    8. return people