Leetcode-Python 寻找两个有序数组的中位数
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
temp = nums1+nums2
temp.sort()
if len(temp)%2 == 0:
flag = int(len(temp)/2)
return (temp[flag]+temp[flag-1])/2
else:
return temp[int(len(temp)/2)]
github项目地址:https://github.com/JockWang/LeetCode-Python