标签:class people span color lis queue int public result
This is SO AWESOME solution.
class Solution { public int[][] reconstructQueue(int[][] people) { Arrays.sort(people, (p1, p2) -> p1[0] != p2[0] ? p2[0] - p1[0] : p1[1] - p2[1]); List<int[]> result = new ArrayList<>(); for (int[] p : people) { result.add(p[1], p); } return result.toArray(new int[people.length][]); } }
LeetCode 406: Queue Reconstruction
标签:class people span color lis queue int public result
原文地址:http://www.cnblogs.com/shuashuashua/p/7637647.html