Skip to content

Commit d9fba9d

Browse files
add 1151
1 parent 59ad48d commit d9fba9d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ public static class Solution1 {
99
public int minSwaps(int[] data) {
1010
int oneCount = 0;
1111
for (int d : data) {
12-
if (d == 1) {
13-
oneCount++;
14-
}
12+
oneCount += d;
1513
}
1614
if (oneCount <= 1) {
1715
return 0;

Diff for: src/test/java/com/fishercoder/secondthousand/_1151Test.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._1151;
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 org.junit.Assert.assertEquals;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
88

99
public class _1151Test {
1010
private static _1151.Solution1 solution1;
1111
private static int[] data;
1212
private static int expected;
1313

14-
@BeforeClass
15-
public static void setup() {
14+
@BeforeEach
15+
public void setup() {
1616
solution1 = new _1151.Solution1();
1717
}
1818

0 commit comments

Comments
 (0)