Count median [python] RT=99ms


  • 0
    P

    class Solution(object):
    def findMedianSortedArrays(self, nums1, nums2):

        tmp=[]
        tmp=nums1+nums2
        tmp.sort()
        length=len(tmp)
        median=0
        if(length % 2 != 0):
            median= tmp[(length/2)]
        elif(length==2):
            median=sum(tmp)/2.0
        else:
            median=(tmp[length/2]+tmp[(length/2)-1])/2.0
        
        return median

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.