We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd1f14b commit 24df592Copy full SHA for 24df592
src/main/java/com/fishercoder/solutions/_703.java
@@ -30,20 +30,20 @@ public class _703 {
30
public static class Solution1 {
31
public static class KthLargest {
32
PriorityQueue<Integer> heap;
33
- int K;
+ int maxK;
34
35
public KthLargest(int k, int[] nums) {
36
heap = new PriorityQueue<>(Collections.reverseOrder());
37
for (int num : nums) {
38
heap.offer(num);
39
}
40
- K = k;
+ maxK = k;
41
42
43
public int add(int val) {
44
List<Integer> tmp = new ArrayList<>();
45
int result = 0;
46
- int tmpK = K;
+ int tmpK = maxK;
47
heap.offer(val);
48
while (tmpK-- > 0) {
49
result = heap.poll();
0 commit comments