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

src/main/java/com/fishercoder/solutions/fourththousand/_3318.java

Lines changed: 7 additions & 1 deletion
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++) {
Lines changed: 6 additions & 6 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy