PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Amazon

Implement LRU cache with O(1) ops

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in cache design and efficient data structures, covering LRU eviction semantics, O(1) average-time get/put operations, update and missing-key behavior, concurrency/thread-safety considerations, and testing strategy within the Coding & Algorithms domain.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Implement LRU cache with O(1) ops

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Design and implement a fixed-capacity cache supporting get(key) -> value and put(key, value) in O( 1) average time. When capacity is reached, evict the least recently used entry. Specify how recency is updated on get and put, how updates to existing keys are handled, what to return for missing keys, and discuss thread-safety options and testing strategy.

Quick Answer: This question evaluates proficiency in cache design and efficient data structures, covering LRU eviction semantics, O(1) average-time get/put operations, update and missing-key behavior, concurrency/thread-safety considerations, and testing strategy within the Coding & Algorithms domain.

Related Interview Questions

  • Implement Datacenter Router Commands - Amazon (hard)
  • Replace Delimited Tokens in a String - Amazon (medium)
  • Minimize Circular Redistribution Cost - Amazon (medium)
  • Find the Most Common Visit Pattern - Amazon (hard)
  • Maximize Value Under a Budget - Amazon (medium)
Amazon logo
Amazon
Aug 9, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
3
0

Design and implement a fixed-capacity cache supporting get(key) -> value and put(key, value) in O(

  1. average time. When capacity is reached, evict the least recently used entry. Specify how recency is updated on get and put, how updates to existing keys are handled, what to return for missing keys, and discuss thread-safety options and testing strategy.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.