class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
#用sort排序,lambda表达式表示按第一个元素降序,第一个相等则按第二个升序
people = sorted(people, key=lambda x:(-x[0], x[1]))
res = []
for i in range(len(people)):
k = people[i][1] #取people成员的k值
res.insert(k, people[i]) #按k值插入
return res