File tree 3 files changed +25
-10
lines changed
g1801_1900/s1825_finding_mk_average
g3401_3500/s3425_longest_special_path
test/java/g1801_1900/s1825_finding_mk_average
3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 6
6
import java .util .LinkedList ;
7
7
import java .util .TreeSet ;
8
8
9
- @ SuppressWarnings ("java:S2184" )
10
9
public class MKAverage {
11
- private int capacity ;
12
- private int boundary ;
13
- private int [] nums ;
14
- private TreeSet <Integer > numSet ;
15
- private LinkedList <Integer > order ;
10
+ private final int capacity ;
11
+ private final int boundary ;
12
+ private final int [] nums ;
13
+ private final TreeSet <Integer > numSet ;
14
+ private final LinkedList <Integer > order ;
16
15
17
16
public MKAverage (int m , int k ) {
18
17
this .capacity = m ;
@@ -63,7 +62,9 @@ public int calculateMKAverage() {
63
62
}
64
63
}
65
64
66
- /**
67
- * Your MKAverage object will be instantiated and called as such: MKAverage obj = new MKAverage(m,
68
- * k); obj.addElement(num); int param_2 = obj.calculateMKAverage();
65
+ /*
66
+ * Your MKAverage object will be instantiated and called as such:
67
+ * MKAverage obj = new MKAverage(m, k);
68
+ * obj.addElement(num);
69
+ * int param_2 = obj.calculateMKAverage();
69
70
*/
Original file line number Diff line number Diff line change 6
6
import java .util .ArrayList ;
7
7
import java .util .List ;
8
8
9
- @ SuppressWarnings (" unchecked" )
9
+ @ SuppressWarnings ({ "java:S107" , " unchecked"} )
10
10
public class Solution {
11
11
public int [] longestSpecialPath (int [][] edges , int [] nums ) {
12
12
int n = edges .length + 1 ;
Original file line number Diff line number Diff line change @@ -19,4 +19,18 @@ void mKAverage() {
19
19
obj .addElement (5 );
20
20
assertThat (obj .calculateMKAverage (), equalTo (5 ));
21
21
}
22
+
23
+ @ Test
24
+ void mKAverage2 () {
25
+ MKAverage obj = new MKAverage (6 , 1 );
26
+ obj .addElement (3 );
27
+ obj .addElement (1 );
28
+ assertThat (obj .calculateMKAverage (), equalTo (-1 ));
29
+ obj .addElement (12 );
30
+ assertThat (obj .calculateMKAverage (), equalTo (-1 ));
31
+ obj .addElement (5 );
32
+ obj .addElement (3 );
33
+ obj .addElement (4 );
34
+ assertThat (obj .calculateMKAverage (), equalTo (3 ));
35
+ }
22
36
}
You can’t perform that action at this time.
0 commit comments