Tap here to switch tabs
Problem
Submissions

Problem: Queue Reconstruction by Height

Queue Reconstruction by Height gives each person’s height and the number of equally tall or taller people ahead. Return an ordering that satisfies everyone’s requirement.

Statement

You are given an array people, representing attributes of individuals standing in a queue. Each element people[i] == [h_i, k_i] describes a person of height h_i who has exactly k_i other people in front of them with a height greater than or equal to h_i.

Reconstruct and return the queue such that every person is placed in an order satisfying their height and positional requirements.

Constraints:

  • 1≤1 \leq people.length ≤2000\leq 2000

  • 0≤0 \leq h_i ≤106\leq 10^6

  • 0≤0 \leq k_i << people.length

  • It is guaranteed that the queue can be reconstructed.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Queue Reconstruction by Height

Queue Reconstruction by Height gives each person’s height and the number of equally tall or taller people ahead. Return an ordering that satisfies everyone’s requirement.

Statement

You are given an array people, representing attributes of individuals standing in a queue. Each element people[i] == [h_i, k_i] describes a person of height h_i who has exactly k_i other people in front of them with a height greater than or equal to h_i.

Reconstruct and return the queue such that every person is placed in an order satisfying their height and positional requirements.

Constraints:

  • 1≤1 \leq people.length ≤2000\leq 2000

  • 0≤0 \leq h_i ≤106\leq 10^6

  • 0≤0 \leq k_i << people.length

  • It is guaranteed that the queue can be reconstructed.