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) {
1111 map .put (num , map .getOrDefault (num , 0 ) + 1 );
1212 }
1313 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 );
1915 }
2016 for (int key : map .keySet ()) {
2117 if (map .get (key ) != 0 ) {
Original file line number Diff line number Diff line change 11package com .fishercoder .secondthousand ;
22
33import 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 ;
66
7- import static junit .framework . TestCase .assertEquals ;
7+ import static org . junit .jupiter . api . Assertions .assertEquals ;
88
99public class _1460Test {
1010 private static _1460 .Solution1 solution1 ;
1111 private static int [] target ;
1212 private static int [] arr ;
1313
14- @ BeforeClass
15- public static void setup () {
14+ @ BeforeEach
15+ public void setup () {
1616 solution1 = new _1460 .Solution1 ();
1717 }
1818
You can’t perform that action at this time.
0 commit comments