mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
@ -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<>();
|
||||
|
Reference in New Issue
Block a user