Skip to content

Latest commit

 

History

History
 
 

first-unique-number

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Design] [Hash Table]

Hints

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).