This commit is contained in:
parent
e46461e1e1
commit
1e0eafc883
1 changed files with 7 additions and 0 deletions
7
easy/sort_the_people.py
Normal file
7
easy/sort_the_people.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# https://leetcode.com/problems/sort-the-people
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
class Solution:
|
||||||
|
def sortPeople(self, names: List[str], heights: List[int]) -> List[str]:
|
||||||
|
v =sorted(zip(heights, names), key=lambda pair: pair[0], reverse=True)
|
||||||
|
return [name for _, name in v ]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue