2418. Sort the People
All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : July 22, 2024
Last updated : July 22, 2024
Related Topics : Array, Hash Table, String, Sorting
Acceptance Rate : 85.06 %
class Solution:
def sortPeople(self, names: List[str], heights: List[int]) -> List[str]:
return [x for x, h in sorted(zip(names, heights), key=lambda y: y[1], reverse=True)]