My AC Java Solution


  • 0
    D
            Arrays.sort(people, new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    return o1[0] == o2[0] ? o1[1] - o2[1] : o2[0] - o1[0];
                }
            });
    
            List<int[]> res = new LinkedList<>();
            for (int[] cur : people) {
                res.add(cur[1], cur);
            }
    
            return res.toArray(new int[people.length][]);
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.