# Remove Duplicates from Sorted Array (Leetcode 26)

Problem Link: <https://leetcode.com/problems/remove-duplicates-from-sorted-array/>

```python
class Solution:
    def removeDuplicates(self, nums: List[int]) -> int:
        # Do not return anything
        n=len(nums)
        ans=[]
        i=0
        j=0
        while(j<n):
            while(j<n and nums[j]==nums[i]):
                j+=1
            if(j==n):
                ans.append(nums[i])
                break
            else:
                ans.append(nums[i])
                i=j
        nums[:]=ans
```
