class Solution {
public:
/**
* find median in two sorted array
* @param arr1 int整型vector the array1
* @param arr2 int整型vector the array2
* @return int整型
*/
int findMedianinTwoSortedAray(vector<int>& arr1, vector<int>& arr2) {
// write code here
int n=arr1.size();
int cur1=0,cur2=0;
for(int i=1;i<n;i++){
if(arr1[cur1]<arr2[cur2]){
cur1++;
}
else cur2++;
}
if(arr1[cur1]<arr2[cur2])
return arr1[cur1];
else return arr2[cur2];
}
};
public:
/**
* find median in two sorted array
* @param arr1 int整型vector the array1
* @param arr2 int整型vector the array2
* @return int整型
*/
int findMedianinTwoSortedAray(vector<int>& arr1, vector<int>& arr2) {
// write code here
int n=arr1.size();
int cur1=0,cur2=0;
for(int i=1;i<n;i++){
if(arr1[cur1]<arr2[cur2]){
cur1++;
}
else cur2++;
}
if(arr1[cur1]<arr2[cur2])
return arr1[cur1];
else return arr2[cur2];
}
};