Module Expr Str Assign NameStore Str ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Num While CompareLt NameLoad NameLoad body If CompareEq SubscriptLoad NameLoad Index NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad AugAssignAdd NameStore Num orelse If BoolOpAnd CompareIsNot SubscriptLoad NameLoad Index NameLoad NameLoad CompareNotEq SubscriptLoad NameLoad Index NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign TupleStore SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad orelse AugAssignAdd NameStore Num If UnaryOpNot NameLoad body Return NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list If CompareEq NameLoad Str body Assert CompareEq Call AttributeLoad Call NameLoad attr ListLoad Num Num Num
N/A N/A 
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

For example,
Given nums = [0, 1, 3] return 2.

Note:
Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space
complexity?
 N/A __author__ Daniel Solution N/A object N/A missingNumber N/A N/A self nums N/A N/A N/A 
        Algorithm:
        Hashmap, but to save space, use the array itself as the hashmap

        Notice:
            nums[i], nums[nums[i]] = nums[nums[i]], nums[i]
        Above is wrong, since evaluate from left to right; thus, when nums[nums[i]] on RHS is None, on LHS, nums[i] is
        eval to None and nums[nums[i]] indexes by None, causing errors.

        Alternatively, it is correct that:
            nums[nums[i]], nums[i]= nums[i], nums[nums[i]]

        To be safe, just use:
            j = nums[i]
            nums[i], nums[j] = nums[j], nums[i]

        :type nums: List[int]
        :rtype: int
         N/A num_n None N/A n N/A len nums N/A i 0 N/A N/A i n N/A N/A N/A N/A nums N/A i n N/A N/A num_n N/A nums N/A i N/A N/A nums N/A i None N/A i 1 N/A N/A N/A N/A N/A nums N/A i None N/A N/A nums N/A i i N/A N/A j N/A nums N/A i N/A N/A N/A nums N/A i N/A nums N/A j N/A N/A nums N/A j N/A nums N/A i N/A N/A i 1 N/A N/A num_n N/A N/A n N/A N/A N/A nums index None N/A N/A N/A N/A __name__ __main__ N/A N/A N/A N/A N/A N/A Solution missingNumber N/A 2 0 1