Skip to content

Instantly share code, notes, and snippets.

@Zheaoli
Last active September 9, 2017 18:48
Show Gist options
  • Save Zheaoli/1fdad241dbfdd2db43df5af707f7e10f to your computer and use it in GitHub Desktop.
Save Zheaoli/1fdad241dbfdd2db43df5af707f7e10f 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
"""
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