112 ms Can anyone tell me the complexity of my code (sorry i am new to cs)


  • 0
    S

    Can anyone tell me the complexity of my code, sorry i am new in cs

    class Solution(object):
        def findMedianSortedArrays(self, nums1, nums2):
            whole_list = nums1 + nums2
            whole_list.sort()
            n = len(whole_list)
            if n%2 == 0:
                return(float(whole_list[n/2]+whole_list[(n/2)-1])/2)
            else:
                return(whole_list[divmod(n, 2)[0]])
    

  • 0

    Your supposed to do it without using sort().


  • 0
    S

    Oh i see is that a standard during interview questions?
    Because the description didn t say any thing about restrictions.
    Sorry for the beginner questions, I am new to this


Log in to reply
 

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