Last active
September 9, 2017 18:48
-
-
Save Zheaoli/1fdad241dbfdd2db43df5af707f7e10f 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 | |
""" | |
tempList=nums1+nums2 | |
tempList=sorted(tempList) | |
if len(tempList) % 2==0: | |
return float(tempList[len(tempList)/2-1] + tempList[len(tempList)/2]) / 2 | |
else: | |
return tempList[int(len(tempList)/2)] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment