LeetCode: Sort the People
Problem:
https://leetcode.com/problems/sort-the-people/
Code:
class Solution:
def sortPeople(self, names: List[str], heights: List[int]) -> List[str]:
return [name for height, name in sorted(zip(heights, names), reverse=True)]
Key Points...
is-power-of-two.hashnode.dev1 min read