Interview guides / ios
LRU cache: iOS Interview Question
LRU cache interview question with a clear example answer for iOS engineers. Practice with AceMobileInterview.
This is a common iOS interview topic: LRU cache.
Below is a concise answer you can adapt in a real interview, then go deeper in the full AceMobileInterview track.
1.Design an LRU cache with O(1) get and put. What data structures would you use in Swift?
Dictionary for key → node plus a doubly linked list (or ordered dictionary pattern) for recency. On get/put, move node to head; on capacity overflow, evict tail. Clarify thread safety if asked—actors or locks around the structure.
Keep going with AceMobileInterview
Reading helps. Timed practice locks it in. Jump into the interactive track for algorithms with LeetCode links, studio projects, debugging zips, and mobile system design.