Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xiaotangyuan/8d891027458fccba7489fac15b9b4849 to your computer and use it in GitHub Desktop.
Save xiaotangyuan/8d891027458fccba7489fac15b9b4849 to your computer and use it in GitHub Desktop.
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums = nums1 + nums2
nums = sorted(nums)
total = len(nums)
if total % 2 == 0:
return (nums[total/2-1] + nums[total/2]) / 2.0
else:
return nums[total/2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment