Write a constant-time Python 3 implementation of LRU cache. Use any Python data structures. The provided unit tests must pass. You have 15 minutes.
Anonymous
When I attempted to solve this problem using the in-built sorted feature of the dictionary data structure in Python 3.6+, I was told that using it is not fair, that I cannot assume a dictionary to be sorted. I was mystified since just moments ago I had been told to use any Python data structure. It's as if I was being set up to fail. After my time was up, the interviewer proceeded to talk about his ideal implementation which used pointers. Did he not know that Python doesn't use pointers? He nitpicked about why my time-restricted approach wasn't DRY. Also, what does implementing an LRU cache have to do with any real-life problem that is to be solved in this time frame?
Check out your Company Bowl for anonymous work chats.