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
            
            

上一篇 下一篇

猜你喜欢

热点阅读