打卡题目:leetcode第406题,根据身高重建队列
相似题目:435
【代码】
class Solution:def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:# 排序people = sorted(people, key=lambda x: (-x[0], x[1]))# “插入排序”, k相同时,h小的在前面for i, (h, k) in enumerate(people):people.insert(k, people.pop(i))return people
