406.Queue-Reconstruction-by-Height
406. Queue Reconstruction by Height
题目地址
https://leetcode.com/problems/queue-reconstruction-by-height/
题目描述
代码
Approach #1 Greedy
Pick out tallest group of people and sort them in a subarray (S). Since there's no other groups of people taller than them, therefore each guy's index will be just as same as his k value.
For 2nd tallest group (and the rest), insert each one of them into (S) by k value. So on and so forth.
Last updated