Created
August 14, 2020 03:50
-
-
Save Irene-123/2bfa0fb965ebc5b7e53d1f8c4f9f4e6b to your computer and use it in GitHub Desktop.
406. Queue Reconstruction by Height LeetCode Python Solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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