Queue Reconstruction by Height
Medium
Arrays
Array
Greedy
Sorting
People with [height, #people_ahead_taller_or_equal]. Reconstruct queue.
Constraints
1 ≤ n ≤ 2000
Examples
Example 1:
Input: 7 0
4 4
7 1
5 0
6 1
5 2
Output: 5 0
7 0
5 2
6 1
4 4
7 1
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console