406. Queue Reconstruction by Hei
2016-12-17 本文已影响0人
阿团相信梦想都能实现
class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
res=[]
people.sort(key=lambda x:x[1])
people.sort(key=lambda x:-x[0])
for p in people:
res.insert(p[1],p)
return res