mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
@ -188,15 +188,10 @@ Java:
|
|||||||
```java
|
```java
|
||||||
class Solution {
|
class Solution {
|
||||||
public int[][] reconstructQueue(int[][] people) {
|
public int[][] reconstructQueue(int[][] people) {
|
||||||
Arrays.sort(people, new Comparator<int[]>() {
|
// 身高从大到小排(身高相同k小的站前面)
|
||||||
@Override
|
Arrays.sort(people, (a, b) -> {
|
||||||
public int compare(int[] o1, int[] o2) {
|
if (a[0] == b[0]) return a[1] - b[1];
|
||||||
if (o1[0] != o2[0]) {
|
return b[0] - a[0];
|
||||||
return Integer.compare(o2[0],o1[0]);
|
|
||||||
} else {
|
|
||||||
return Integer.compare(o1[1],o2[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
LinkedList<int[]> que = new LinkedList<>();
|
LinkedList<int[]> que = new LinkedList<>();
|
||||||
|
Reference in New Issue
Block a user