ByteDance logo

ByteDance DevOps Engineer System Design Questions

31 practice questions for ByteDance DevOps Engineer interviews

ByteDance DevOps engineer interviews cover CI/CD pipelines, infrastructure as code, container orchestration, monitoring, and incident response procedures.

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 ByteDance.

system design Senior caching #1

1. [OA] LRU Cache — Implement the caching layer ByteDance uses for its API responses

ByteDance requires an efficient caching mechanism to reduce latency for frequently accessed API responses. Your task is to implement an LRU (Least Recently Used) Cache class that supports get and put operations.
Problem statement:
The LRU Cache should have a maximum capacity and evict the least recently used item when the capacity is reached.
Method signatures:
  • def get(self, key: int) -> int:: Get the value of the key if the key exists in the cache, otherwise return -1.

  • def put(self, key: int, value: int) -> None:: Update the value of the key or insert the key if it is not already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.


Example 1:
Input: cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1)
Output: 1
Explanation: Returns 1
Example 2:
Input: cache.put(3, 3)
cache.get(2)
Output: -1
Explanation: Evicts key 2 and returns -1.
Constraints:
  • Capacity of the cache will not exceed 3000.

  • All keys and values will be in the range of 1 <= key,value <= 10^4.

Related ByteDance DevOps Engineer interview prep

Start practicing ByteDance questions

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

Get Started Free