先发一个暴力版
class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int m = nums1.size(), n = nums2.size();
int k = 0, i = 0, j = 0;
vector<int> arr(m + n, 0);
while (i < m && j < n)
{
arr[k++] = nums1[i] < nums2[j] ? nums1[i++] : nums2[j++];
}
while (i < m) arr[k++] = nums1[i++];
while (j < n) arr[k++] = nums2[j++];
return k % 2 ? arr[k / 2] : (arr[k / 2] + arr[k / 2 - 1]) / 2.0;
}
};