import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param arr1 int整型一维数组
* @param arr2 int整型一维数组
* @param target int整型
* @return int整型
*/
public int findKthNum (int[] arr1, int[] arr2, int target) {
// write code here
// 归并排序
int n1 = arr1.length;
int n2 = arr2.length;
int i = 0, j = 0;
int index = 0;
while(i < n1 && j < n2) {
index++;
if(arr1[i] > arr2[j]) {
if(index == target)
return arr2[j];
j++;
} else {
if(index == target)
return arr1[i];
i++;
}
}
while(i < n1) {
index++;
if(index == target)
return arr1[i];
i++;
}
while(j < n2) {
index++;
if(index == target)
return arr2[j];
j++;
}
return -1;
}
}