From 5945c3af6f667ef40dd981f6236c724e66757e5c Mon Sep 17 00:00:00 2001 From: Nahom Garefo <119704083+Blacknahil@users.noreply.github.com> Date: Tue, 26 Dec 2023 19:15:59 +0300 Subject: [PATCH] Added solution for Sort the People --- week4/sort-the-people.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 week4/sort-the-people.py diff --git a/week4/sort-the-people.py b/week4/sort-the-people.py new file mode 100644 index 0000000..2f16ac0 --- /dev/null +++ b/week4/sort-the-people.py @@ -0,0 +1,7 @@ +class Solution: + def sortPeople(self, names: List[str], heights: List[int]) -> List[str]: + return [n for n, h in sorted(zip(names, heights), key=lambda x: x[1], reverse=True)] + + #one liner + + \ No newline at end of file