Created
June 29, 2016 09:32
-
-
Save xiaotangyuan/8d891027458fccba7489fac15b9b4849 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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