title: Design a Data Structure with insert (key,value),get,delete & get last accessed key operations with each O(1) complexity
body: <p>I can create a class with members map to store key,value and stack
  to maintain the history of operations performed onto the class
  objects. However, the tricky part is last key retrieval in O(1)- 
  if a key has been deleted, I would require to search the entire
  stack for valid key in the map, which will be of O(n) in the worst case.</p>
  
  <p>For instance </p>
  
  <pre><code>insert(a,1)
  insert(b,1)
  get(a) -&gt; output 1
  get_last_key -&gt; output a delete(a)
  get_last_key -&gt; output b
  </code></pre>
  
  <p>Is there a better way of designing the structure for better performance?</p>