LRU Cache with Photo Storage
Implement an LRU cache with a `put(byte[] photo)` method that persists a photo to memory and returns a generated unique ID (UUID), and a `get(String id)` method that retrieves the photo by ID. The LRU eviction policy should be based on the total size of the stored photos in bytes, not the number of entries in the cache.
Asked at:
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early April, 2026
Microsoft
Senior
LRU cache implementation for the put(byte[] photo) also persist in memory and generate id(UUID or global id) get(string id) return the photo. LRU eviction is based on the size of photo not the size of hashmap.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.