Skip to content

Commit e3380d3

Browse files
update 1460
1 parent 088ebc7 commit e3380d3

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

Diff for: src/main/java/com/fishercoder/solutions/secondthousand/_1460.java

+1-5
Original file line numberDiff line numberDiff 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) {

Diff for: src/test/java/com/fishercoder/secondthousand/_1460Test.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package com.fishercoder.secondthousand;
22

33
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;
66

7-
import static junit.framework.TestCase.assertEquals;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
88

99
public 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

0 commit comments

Comments
 (0)