File tree 2 files changed +6
-8
lines changed
main/java/com/fishercoder/solutions/secondthousand
test/java/com/fishercoder/secondthousand
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,7 @@ public static class Solution1 {
9
9
public int minSwaps (int [] data ) {
10
10
int oneCount = 0 ;
11
11
for (int d : data ) {
12
- if (d == 1 ) {
13
- oneCount ++;
14
- }
12
+ oneCount += d ;
15
13
}
16
14
if (oneCount <= 1 ) {
17
15
return 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 ._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 ;
6
6
7
- import static org .junit .Assert .assertEquals ;
7
+ import static org .junit .jupiter . api . Assertions .assertEquals ;
8
8
9
9
public class _1151Test {
10
10
private static _1151 .Solution1 solution1 ;
11
11
private static int [] data ;
12
12
private static int expected ;
13
13
14
- @ BeforeClass
15
- public static void setup () {
14
+ @ BeforeEach
15
+ public void setup () {
16
16
solution1 = new _1151 .Solution1 ();
17
17
}
18
18
You can’t perform that action at this time.
0 commit comments