How would you implement an LRU Cache (LRU - Least Recently Used). What would your data structure look like. This was also a whiteboard problem.
Anonymous
The answer is to use a LinkedHashMap or a similar data structure because it allows O(1) on all needed operations.
Check out your Company Bowl for anonymous work chats.