class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
n = []
for i in range(len(nums1)):
n.append(nums1[i])
for i in range(len(nums2)):
n.append(nums2[i])
n.sort()
print(n)
a = len(n)//2
if len(n)%2 != 0:
s = n[a]
return s
else:
s = (n[a]+n[a-1])/2.0
return s
print(s)
leetcode题集之寻找两个正序数组的中位数
最新推荐文章于 2024-11-10 14:06:08 发布