You are given an array with duplicate elements, write a program to remove all duplicates from the array.

Problem Notes

  • All elements of the resultant array must be unique.
  • It's better if the algorithm is in-place.

Example 1

Input: A[] = [-1,0,1,1,2,9,9]
Output: [-1,0,1,2,9]

Example 2

Input: A[] = [-10,1,3,6,6,6,6,10]
Output: [-10,1,3,6,10]

Example 3

Input: A[] = [10,20,30,33,45]
Output: [10,20,30,33,45]
Explanation: No elements were repeated

Example 4

Input: A[] = [1,1,1,1,1,1]
Output: [1]
Explanation: The only unique element was 1