标签:图片 alt img python mamicode elf code info inf
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
nums1.extend(nums2)
nums1.sort()
if len(nums1) % 2 == 0:
return (nums1[len(nums1) // 2 ]+nums1[len(nums1) // 2 - 1 ])/2
else:
return nums1[len(nums1) // 2 ]
python中extends方法:合并两个list
标签:图片 alt img python mamicode elf code info inf
原文地址:https://www.cnblogs.com/fanx-1995/p/11328948.html