How to caculate my python code time complexity (Two Sum Problem)?

  • 0
    def Dick_Mark(nums):
        L ={}
        for index,key in  list(enumerate(nums)):
        return L
    def foo(nums,target):
        RESULT = []
        Value_Index_dict = Dick_Mark(nums)
        Values = set(Value_Index_dict.keys())
        print Values
        print Value_Index_dict
        for beijiashu in Values:
            if target-beijiashu in Values:
                print 'yes' 
                if beijiashu < target-beijiashu:
                    print Value_Index_dict
                    RESULT.append(Value_Index_dict.get( target-beijiashu ).pop())
                if beijiashu == target-beijiashu:
                    if len(Value_Index_dict.get(beijiashu))>1:
                        for shu in Value_Index_dict.get(beijiashu):
        return RESULT

Log in to reply

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