Merge pull request #501 from daniel1n/patch-7

Update 0406.根据身高重建队列.md
This commit is contained in:
程序员Carl
2021-07-21 09:55:59 +08:00
committed by GitHub

View File

@ -188,15 +188,10 @@ Java
```java
class Solution {
public int[][] reconstructQueue(int[][] people) {
Arrays.sort(people, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
if (o1[0] != o2[0]) {
return Integer.compare(o2[0],o1[0]);
} else {
return Integer.compare(o1[1],o2[1]);
}
}
// 身高从大到小排身高相同k小的站前面
Arrays.sort(people, (a, b) -> {
if (a[0] == b[0]) return a[1] - b[1];
return b[0] - a[0];
});
LinkedList<int[]> que = new LinkedList<>();