Участник:Larin.dv/Queue Reconstruction by Height

Материал из DISCOPAL
Перейти к: навигация, поиск

https://leetcode.com/problems/queue-reconstruction-by-height/

class Solution(object):
    def reconstructQueue(self, people):
        people.sort(key=lambda x:(-x[0],x[1]))
        print(people)
        queue = []
        for p in people:
            queue.insert(p[1], p)
        return queue