Tap here to switch tabs
Problem
Submissions

Problem: Sort the People

med
30 min
Try to solve the Sort the People problem.

Statement

You are given an array of strings names, and an array heights consisting of distinct positive integers, where both arrays have a length of n.

For each index i, names[i] and heights[i] represent the name and height of the iextthi^{ ext{th}} person.

Return names sorted in descending order based on the people’s heights.

Constraints:

  • n ==== names.length ==== heights.length

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq names[i].length ≤20\leq 20

  • 1≤1 \leq heights[i] ≤105\leq 10^5

  • names[i] consists of lowercase and uppercase English letters.

  • All the values of heights are distinct.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort the People

med
30 min
Try to solve the Sort the People problem.

Statement

You are given an array of strings names, and an array heights consisting of distinct positive integers, where both arrays have a length of n.

For each index i, names[i] and heights[i] represent the name and height of the iextthi^{ ext{th}} person.

Return names sorted in descending order based on the people’s heights.

Constraints:

  • n ==== names.length ==== heights.length

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq names[i].length ≤20\leq 20

  • 1≤1 \leq heights[i] ≤105\leq 10^5

  • names[i] consists of lowercase and uppercase English letters.

  • All the values of heights are distinct.