美文网首页
406. Queue Reconstruction by Hei

406. Queue Reconstruction by Hei

作者: 阿团相信梦想都能实现 | 来源:发表于2016-12-17 04:54 被阅读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
                
                
    
    

    相关文章

      网友评论

          本文标题:406. Queue Reconstruction by Hei

          本文链接:https://www.haomeiwen.com/subject/lheomttx.html