Skip to content

Commit 0605e0c

Browse files
[LEET-3318] fix build
1 parent 7b53699 commit 0605e0c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Diff for: src/main/java/com/fishercoder/solutions/fourththousand/_3318.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
public class _3318 {
88
public static class Solution1 {
99
public int[] findXSum(int[] nums, int k, int x) {
10-
PriorityQueue<int[]> maxHeap = new PriorityQueue<>((a, b) -> a[1] != b[1] ? b[1] - a[1] : b[0] - a[0]);//a[0] is the number itself, a[1] is the frequency
10+
PriorityQueue<int[]> maxHeap =
11+
new PriorityQueue<>(
12+
(a, b) ->
13+
a[1] != b[1]
14+
? b[1] - a[1]
15+
: b[0] - a[0]); // a[0] is the number itself, a[1]
16+
// is the frequency
1117
Map<Integer, int[]> map = new HashMap<>();
1218
int i = 0;
1319
for (; i < k; i++) {
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.fishercoder.fourththousand;
22

3+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4+
35
import com.fishercoder.solutions.fourththousand._3318;
46
import org.junit.jupiter.api.BeforeEach;
57
import org.junit.jupiter.api.Test;
68

7-
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
8-
99
public class _3318Test {
1010

1111
private _3318.Solution1 solution1;
@@ -18,13 +18,13 @@ public void setup() {
1818

1919
@Test
2020
public void test1() {
21-
nums = new int[]{1, 1, 2, 2, 3, 4, 2, 3};
22-
assertArrayEquals(new int[]{6, 10, 12}, solution1.findXSum(nums, 6, 2));
21+
nums = new int[] {1, 1, 2, 2, 3, 4, 2, 3};
22+
assertArrayEquals(new int[] {6, 10, 12}, solution1.findXSum(nums, 6, 2));
2323
}
2424

2525
@Test
2626
public void test2() {
27-
nums = new int[]{3, 8, 7, 8, 7, 5};
28-
assertArrayEquals(new int[]{11, 15, 15, 15, 12}, solution1.findXSum(nums, 2, 2));
27+
nums = new int[] {3, 8, 7, 8, 7, 5};
28+
assertArrayEquals(new int[] {11, 15, 15, 15, 12}, solution1.findXSum(nums, 2, 2));
2929
}
3030
}

0 commit comments

Comments
 (0)