File tree 2 files changed +15
-18
lines changed
main/java/com/fishercoder/solutions
test/java/com/fishercoder 2 files changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,10 @@ public int[] twoSum(int[] numbers, int target) {
32
32
} else if (sum < target ) {
33
33
left ++;
34
34
} else {
35
- int [] res = new int [2 ];
36
- res [0 ] = left + 1 ;
37
- res [1 ] = right + 1 ;
38
- return res ;
35
+ return new int []{left + 1 , right + 1 };
39
36
}
40
37
}
41
- return new int [] {-1 , -1 };
38
+ return new int []{-1 , -1 };
42
39
}
43
40
}
44
41
}
Original file line number Diff line number Diff line change 7
7
import static org .junit .Assert .assertArrayEquals ;
8
8
9
9
public class _167Test {
10
- private static _167 .Solution1 solution1 ;
11
- private static int [] numbers ;
12
- private static int [] expected ;
10
+ private static _167 .Solution1 solution1 ;
11
+ private static int [] numbers ;
12
+ private static int [] expected ;
13
13
14
- @ BeforeClass
15
- public static void setup () {
16
- solution1 = new _167 .Solution1 ();
17
- }
14
+ @ BeforeClass
15
+ public static void setup () {
16
+ solution1 = new _167 .Solution1 ();
17
+ }
18
18
19
- @ Test
20
- public void test1 () {
21
- numbers = new int [] {-3 , 3 , 4 , 90 };
22
- expected = new int [] {1 , 2 };
23
- assertArrayEquals (expected , solution1 .twoSum (numbers , 0 ));
24
- }
19
+ @ Test
20
+ public void test1 () {
21
+ numbers = new int []{-3 , 3 , 4 , 90 };
22
+ expected = new int []{1 , 2 };
23
+ assertArrayEquals (expected , solution1 .twoSum (numbers , 0 ));
24
+ }
25
25
}
You can’t perform that action at this time.
0 commit comments