# Missing Number (Leetcode 268)

Problem Link: <https://leetcode.com/problems/missing-number/>

#### Using SUM:

```python
class Solution:
    def missingNumber(self, nums: List[int]) -> int:
        
        n=len(nums)
        
        #### Using sum
        s=sum(nums)
        temp=n*(n+1)//2
        return temp-s
        
```

#### Using XOR:

```python
class Solution:
    def missingNumber(self, nums: List[int]) -> int:
        
        n=len(nums)
        
        #### Using XOR
        xor=0
        for i in range(n+1):
            xor=xor^i
        for i in nums:
            xor=xor^i  
        return xor
        
```
