题目 406. 根据身高重建队列 代码: class Solution: def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]: # 1.双排序:按照身高降序,相同身高按k升序 people.sort(key=lambda x: (-x[0], x[1])) ans = [] # 2.插入:按照前面大于自己的人数插入 for p in people: ans.insert(p[1], p) return ans