File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
main/java/com/fishercoder/solutions/secondthousand
test/java/com/fishercoder/secondthousand Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,7 @@ public boolean canBeEqual(int[] target, int[] arr) {
11
11
map .put (num , map .getOrDefault (num , 0 ) + 1 );
12
12
}
13
13
for (int num : arr ) {
14
- if (!map .containsKey (num )) {
15
- return false ;
16
- } else {
17
- map .put (num , map .get (num ) - 1 );
18
- }
14
+ map .put (num , map .getOrDefault (num , 0 ) - 1 );
19
15
}
20
16
for (int key : map .keySet ()) {
21
17
if (map .get (key ) != 0 ) {
Original file line number Diff line number Diff line change 1
1
package com .fishercoder .secondthousand ;
2
2
3
3
import com .fishercoder .solutions .secondthousand ._1460 ;
4
- import org .junit .BeforeClass ;
5
- import org .junit .Test ;
4
+ import org .junit .jupiter . api . BeforeEach ;
5
+ import org .junit .jupiter . api . Test ;
6
6
7
- import static junit .framework . TestCase .assertEquals ;
7
+ import static org . junit .jupiter . api . Assertions .assertEquals ;
8
8
9
9
public class _1460Test {
10
10
private static _1460 .Solution1 solution1 ;
11
11
private static int [] target ;
12
12
private static int [] arr ;
13
13
14
- @ BeforeClass
15
- public static void setup () {
14
+ @ BeforeEach
15
+ public void setup () {
16
16
solution1 = new _1460 .Solution1 ();
17
17
}
18
18
You can’t perform that action at this time.
0 commit comments