191. First Unique After Each Step
MediumQueueHash Map
Numbers arrive one by one. After each arrival, print the first number seen so far that has appeared exactly once, or -1.
Input format
Line 1: n Line 2: n integers
Output format
n answers.
Example 1
Input
6 2 3 5 2 3 5
Output
2 2 2 3 5 -1
Example 2
Input
3 1 1 1
Output
1 -1 -1
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…