2dbi
Home/Confluent/LRU Cache With TTL
CConfluent·DSAEngineerOnline Assessment

LRU Cache With TTL

Problem

Implement an LRU cache with per-entry TTL (reported Confluent question).

Example

get/put O(1); entries expire after TTL

Constraints

  • Concurrency follow-up likely

Approach

Hash map + doubly linked list + lazy TTL. Be ready to make it thread-safe.

added 6 days ago
LeadersAccount