368. Remove Duplicates from Sorted List
EasyLinked List
The list is sorted. Remove nodes so each value appears once and print the list.
Input format
Line 1: n Line 2: n sorted values
Output format
The deduplicated list.
Example 1
Input
5 1 1 2 3 3
Output
1 2 3
Example 2
Input
3 1 1 1
Output
1
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…