|
@@ -87,15 +87,22 @@ public class ArrayDrills {
|
87
|
87
|
public Integer[] middleWay(Integer[] input1, Integer[] input2){
|
88
|
88
|
int middle1 = 0;
|
89
|
89
|
int middle2 = 0;
|
90
|
|
- if(input1.length%2 > 0 && input2.length%2 > 0) {
|
|
90
|
+ if(input1.length%2 > 0 ) {
|
91
|
91
|
middle1 = input1[input1.length / 2 + 1];
|
92
|
|
- middle2 = input2[input2.length / 2 + 1];
|
93
|
92
|
}
|
94
|
93
|
|
95
|
94
|
else{
|
96
|
95
|
middle1 = (input1.length/2) + (input1.length/2+1);
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ if(input2.length%2 > 0){
|
|
99
|
+ middle2 = input2[input2.length / 2 + 1];
|
|
100
|
+ }
|
|
101
|
+
|
|
102
|
+ else{
|
97
|
103
|
middle2 = (input2.length/2) + (input2.length/2+1);
|
98
|
104
|
}
|
|
105
|
+
|
99
|
106
|
Integer[] middle = {middle1, middle2};
|
100
|
107
|
return middle;
|
101
|
108
|
}
|