class Solution {
public int[][] reconstructQueue(int[][] people) {
if(people.length==0){
return people;
}
Arrays.sort(people, (o1, o2) -> (o1[0]==o2[0])?o1[1]-o2[1]:o2[0]-o1[0]);
ArrayList<int[]> list = new ArrayList<>();
for(int i=0;i<people.length;i+=1){
int[] nowarray = people[i];
list.add(nowarray[1],nowarray);
}
int[][] retarray = new int[people.length][people[0].length];
for(int i=0;i<list.size();i+=1){
retarray[i] = list.get(i);
}
return retarray;
}
}class Solution {
public int[][] re