Skip to content

Commit f93b0bd

Browse files
authored
Create queue_reconstruction_by_height.py
1 parent a07b754 commit f93b0bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
3+
people.sort(key=lambda person: (-person[0], person[1]))
4+
sorted_queue = []
5+
for person in people:
6+
sorted_queue.insert(person[1], person)
7+
return sorted_queue

0 commit comments

Comments
 (0)