Queue Reconstruction by Height
Medium · Greedy · about 20 minutes
Asked at Google, Amazon, Microsoft, Meta.
people[i] = [h, k]: person i has height h and exactly k people in front of them are at least as tall. The array is shuffled. Reconstruct and return the queue.