Welcome to AlgoYogi!
π Start Your Smart Coding Prep at π https://algoyogi.io
We solve LeetCode 2418: Sort the People using Python and a straightforward sorting approach.
Goal: Given arrays `names` and `heights` of equal length, return `names` sorted in descending order of corresponding heights.
Approach:
- Pair each `name` with its `height`
- Sort pairs in descending order of height
- Extract sorted names into result list
π Problem Link: https://leetcode.com/problems/sort-the-people/description/
---
### β± Timestamps
0:00 Introduction
0:10 Problem Statement
2:30 Pairing and Sorting Approach
5:30 Python Code Walkthrough
8:00 Time and Space Complexity
---
### π‘ Why Watch?
- Straightforward and clean use of Python `zip`, `sorted`, and list comprehension
- Great for mapping parallel arrays and custom sort key
- Interview starter problem but good for clean code practice
#LeetCode #SortThePeople #Python #AlgoYogi #Sorting #Zip
Download
0 formats
No download links available.
LeetCode 2418 | Sort the People | Python Zip and Sort by Heights | AlgoYogi | NatokHD