看了一下发现就是用贪心进行解答
但我只写出来排序
后半部分重建参考代码随想录
很巧妙
class Solution {
public int[][] reconstructQueue(int[][] people) {
Arrays.sort(people, (o1, o2) -> {
if(o1[0] == o2[0]) return o1[1] - o2[1];
return o2[0] - o1[0];
});
LinkedList list = new LinkedList<>();
for (int[] i : people) {
list.add(i[1], i);
}
return list.toArray(new int[list.size()][2]);
}
}



