# Missing Number https://leetcode.com/problems/missing-number/ ## Solution 1: Indexing ```python table = [0] * (len(nums) + 1) for num in nums: table[num] = 1 return table.index(0) ``` ## Solution 2: Gauss's Formula (Summation) ```python n = len(nums) return n * (n + 1) // 2 - sum(nums) ``` ## Solution 3: XOR ```python missing = len(nums) for i, num in enumerate(nums): missing ^= i ^ num return missing ``` Utilizing the fact that `x ^ x = 0`, and `x ^ 0 = x`. The index and number cancels each other. Initialize `missing = len(nums)`, since the index `n` is not iterated.