Back to Browse

LeetCode 2418 | Sort the People | Python Zip and Sort by Heights | AlgoYogi

23 views
Oct 26, 2025
9:36

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