abc Interview Question
Country: India
Interview Type: Phone Interview
Use the concept of an array list and combine it with hashing to get the required result.
When you receive a new input (key, value) then append the key to the array list and add the (key,value) pair to a hashset.
To output the items in the order of insertion, traverse the array list and map the keys to the values in the hashset.
You can use the LinkedListHashSet.
- Felipe Cerqueira June 10, 2015