Tap here to switch tabs
Problem
Submissions

Problem: Sort the People

Sort the People pairs each name with a distinct height, then asks you to return the names arranged from tallest to shortest.

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

Sort the People pairs each name with a distinct height, then asks you to return the names arranged from tallest to shortest.

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.