Skip to content

Commit 03957d2

Browse files
refactor 406
1 parent 5ad95ff commit 03957d2

File tree

1 file changed

+1
-21
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+1
-21
lines changed

src/main/java/com/fishercoder/solutions/_406.java

+1-21
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,6 @@
55
import java.util.LinkedList;
66
import java.util.List;
77

8-
/**
9-
* 406. Queue Reconstruction by Height
10-
*
11-
* Suppose you have a random list of people standing in a queue.
12-
* Each person is described by a pair of integers (h, k),
13-
* where h is the height of the person and k is the number of people in
14-
* front of this person who have a height greater than or equal to h. Write an algorithm to reconstruct the queue.
15-
16-
Note:
17-
The number of people is less than 1,100.
18-
19-
Example
20-
21-
Input:
22-
[[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]
23-
24-
Output:
25-
[[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]]
26-
27-
*/
288
public class _406 {
299

3010
public static class Solution1 {
@@ -35,7 +15,7 @@ public int[][] reconstructQueue(int[][] people) {
3515
Arrays.sort(people, new Comparator<int[]>() {
3616
public int compare(int[] p1, int[] p2) {
3717
return p1[0] != p2[0] ? Integer.compare(p2[0], p1[0])
38-
: Integer.compare(p1[1], p2[1]);
18+
: Integer.compare(p1[1], p2[1]);
3919
}
4020
});
4121
List<int[]> list = new LinkedList();

0 commit comments

Comments
 (0)