public int[] join(int[] arr1,int[] arr2){
int[] joinArr=new int[arr1.length + arr2.length];
int j=0,k=0;
for(int i=0;i<joinArr.length;i++){
if(j==arr1.length){
joinArr[i]=arr2[k];
}
else if(k==arr2.length){
joinArr[i]=arr1[j];
}
else if(arr1[j]>arr2[k]){
joinArr[i]=arr1[j];
j++;
}
else{
joinArr[i]=arr2[k];
k++;
}
}
return joinArr;
}
Testcase1 Parameters
{100,90,80,70,60}
{105,95,85,75,65}
Testcase1 Actual Answer
{105,100,95,90,85,80,75,70,65,60}
Testcase1 Expected Answer
{105,100,95,90,85,80,75,70,65,60}
Testcase2 Parameters
{100,90,80,70,60}
{105}
Testcase2 Actual Answer
{105,100,100,100,100,100}
Testcase2 Expected Answer
{105,100,90,80,70,60}
When I run my Testcase2, it doesn't give me the expected answer , how could I fix this problem?