74. Remove Duplicate Entries

Acceptance — 0 accepted 0 submissions

Easy
ArraysTwo Pointers
No companies listed
The attendance register is sorted by roll number, but some roll numbers got entered twice by mistake.

Given the sorted list, print each roll number only once.

Input Format
The first line has n.
The second line has n integers in non-decreasing order.

Output Format
Print the unique values in order, separated by single spaces.

Constraints
• 1 ≤ n ≤ 1000
• -1000 ≤ value ≤ 1000

Example 1

Input
7
1 1 2 3 3 3 4
Output
1 2 3 4

Explanation 1, 2, 3 and 4 each kept once.

Example 2

Input
3
5 5 5
Output
5

Explanation Only 5 remains.

Example 3

Input
4
-2 0 3 8
Output
-2 0 3 8

Explanation Already unique, nothing removed.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
1 2 3 4
No results yet
Run your code to test it against the sample cases.
Problem List