Tesla Phone Screen Cache Problem

Double Pointer
Tech Wrench
Published in
2 min readDec 15, 2020

--

Please consider supporting us by signing up for a paid Medium account.

Don’t forget to buy your copy of System Design Interview — An insider’s guide (volume 2)

Least Recently Used (LRU) Cache is a very common problem asked in interviews. The key to the problem is to realize that a hash table and a doubly linked list can be used to solve it efficiently.

Don’t waste life on Leetcode. Learn patterns with the course Grokking the Coding Interview: Patterns for Coding Questions to beat the interview. Or if you prefer video-based courses check out Udemy courses at 50% off.

Another variant of the LRU problem is the priority-expiry cache. The Educative’s course on Big-O Notation for Coding Interviews and Beyond solves this problem using two heaps and two hash-tables, but isn’t conclusively the best solution. If you have a better solution, we’d love to hear from you and share your solution here with due credits. This questions has been asked in phone-screens at Tesla, Oracle, Salesforce, Google, Facebook and a bunch of other Big Tech according to various online interview forums.

Grokking Modern System Design for Software Engineers and Managers

--

--