프로그래밍/LeetCode
[LeetCode][Python3] 406. Queue Reconstruction by Height
snoopybox
2019. 9. 23. 23:43
Problem :
https://leetcode.com/problems/queue-reconstruction-by-height/
My Solution :
class Solution:
def reconstructQueue(self, people):
people.sort(key=lambda x: (-x[0], x[1]))
ans = []
for h, k in people:
ans.insert(k, (h, k))
return ans