108 ms python solution


  • 0
    S
    class Solution(object):
        def missingNumber(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            obj = {}
            for index, val in enumerate(nums):
                if not obj.get(index):
                    obj[index] = 0
                obj[val] = 1
            for i in range(len(nums)):
                if obj.get(i) == 0:
                    return i
            return len(nums)
            
    

Log in to reply
 

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