767. Eliminate Duplicates

0

Easy

Given a sorted integer array arr, remove any duplicate elements in-place so that each unique element appears only once. The relative order of the elements should remain unchanged.

You must modify the input array in-place using O(1) extra memory, without allocating space for another array.

You must modify the input array in-place using O(1) extra memory, without allocating space for another array.

Input Format

An integer N, followed by N space-separated integers on the next line.

Output Format

Space-separated unique integers.

Example

Input

5
1 1 1 2 2 5

Output

1 2 5

Constraints

1 <= N <= 3 * 10^4

-100 <= arr[i] <= 100

arr is sorted in non-decreasing order.

-100 <= arr[i] <= 100

arr is sorted in non-decreasing order.

Loading...

View Submissions

Console