PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Ambience Healthcare

Design a least-recently-used cache

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of data structures and algorithms for implementing an LRU cache, including choice of data structures, constant-time access and eviction policies, and correct handling of recency updates on reads and writes.

  • Medium
  • Ambience Healthcare
  • Coding & Algorithms
  • Software Engineer

Design a least-recently-used cache

Company: Ambience Healthcare

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Design and implement a least-recently-used (LRU) cache with a fixed capacity. Support get(key) -> value and put(key, value) in average O( 1) time. When the cache is full, evict the least recently used entry. Explain your choice of data structures, detail how you update recency on reads and writes, and describe how you handle updates to existing keys, missing keys, and capacity edge cases (e.g., capacity = 0). Analyze time and space complexity.

Quick Answer: This question evaluates a candidate's understanding of data structures and algorithms for implementing an LRU cache, including choice of data structures, constant-time access and eviction policies, and correct handling of recency updates on reads and writes.

Ambience Healthcare logo
Ambience Healthcare
Jul 31, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
4
0

Design and implement a least-recently-used (LRU) cache with a fixed capacity. Support get(key) -> value and put(key, value) in average O(

  1. time. When the cache is full, evict the least recently used entry. Explain your choice of data structures, detail how you update recency on reads and writes, and describe how you handle updates to existing keys, missing keys, and capacity edge cases (e.g., capacity = 0). Analyze time and space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Ambience Healthcare•More Software Engineer•Ambience Healthcare Software Engineer•Ambience Healthcare Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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.