A Unique List

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Given an array of length N, remove all duplicates in the array and then print it out, sorted in ascending order.

Input Specification

The first line will contain integer N (1 \leq N \leq 8), the size of the array.

The next line will contain array a, the array that you need to remove the duplicates from. It is guaranteed that each element of the array will not be larger than 8.

Output Specification

The same array without the duplicate elements, printed on one line, each element separated by spaces.

Sample Input 1

5
1 2 2 3 4

Sample Output 1

1 2 3 4

Sample Input 2

6
1 2 1 3 4 6

Sample Input 2

1 2 3 4 6

Comments

There are no comments at the moment.