< Previous
Next >
[Array]
[Hash Table]
[Design]
[Queue]
[Data Stream]
Hint 1
Use doubly Linked list with hashmap of pointers to linked list nodes. add unique number to the linked list. When add is called check if the added number is unique then it have to be added to the linked list and if it is repeated remove it from the linked list if exists. When showFirstUnique is called retrieve the head of the linked list.
Hint 2
Use queue and check that first element of the queue is always unique.
Hint 3
Use set or heap to make running time of each function O(logn).