반응형
leetcode.com/problems/queue-reconstruction-by-height/
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
solution = []
people.sort(key= lambda x : (-x[0],x[1]))
for i in range(len(people)):
solution.insert(people[i][1],people[i])
return solution
댓글