Skip to content

Instantly share code, notes, and snippets.

@Irene-123
Created August 14, 2020 03:50
Show Gist options
  • Save Irene-123/2bfa0fb965ebc5b7e53d1f8c4f9f4e6b to your computer and use it in GitHub Desktop.
Save Irene-123/2bfa0fb965ebc5b7e53d1f8c4f9f4e6b to your computer and use it in GitHub Desktop.
406. Queue Reconstruction by Height LeetCode Python Solution
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
people=sorted(people, key=lambda x: (-x[0],x[1]))
res=[]
for p in people:
res.insert(p[1],p)
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment