Airbnb logo

Airbnb Software Engineer System Design Questions

48 practice questions for Airbnb Software Engineer interviews

Airbnb software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer

No verified questions yet for Airbnb.

system design Senior caching #1

1. [OA] LRU Cache — Implement caching for Airbnb property listings

Airbnb needs to optimize its API by implementing a caching mechanism for property listings to reduce database load and improve response time.
Problem statement: Implement an LRU (Least Recently Used) cache with a specified capacity. The cache should support get(key) and put(key, value) operations.
  • class LRUCache:

  • def __init__(self, capacity: int): - Initializes the LRUCache with the maximum capacity.

  • def get(self, key: int) -> int: - Returns the value of the key if the key exists in the cache, otherwise return -1.

  • def put(self, key: int, value: int): - Update the value of the key if it exists, otherwise add the key-value pair to the cache. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.


Example 1:
Input:
cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) // returns 1
cache.put(3, 3) // evicts key 2
cache.get(2) // returns -1 (not found)
Example 2:
Input:
cache.put(4, 4) // evicts key 1
cache.get(1) // returns -1 (not found)
cache.get(3) // returns 3
cache.get(4) // returns 4
Constraints:
  • 1 <= capacity <= 3000

  • 0 <= key <= 10^4

  • 0 <= value <= 10^4

Related Airbnb Software Engineer interview prep

Start practicing Airbnb questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free