ByteDance logo

ByteDance Software Engineer System Design Questions

33 practice questions for ByteDance Software Engineer interviews

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

All Roles 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 for ByteDance's real-time content delivery

For efficient performance on ByteDance's content delivery platform, we need a system that caches frequently accessed user data and drops the least recently used data when the capacity is exceeded.
You are to implement an LRU (Least Recently Used) cache.
Class Name: LRUCache
- Method Signature: def __init__(self, capacity: int):
- Initializes the LRU cache with positive size capacity.
- Method Signature: def get(self, key: int) -> int:
- Returns the value of the key if the key exists, otherwise returns -1.
- Method Signature: def put(self, key: int, value: int) -> None:
- Update or insert the value if the key is not already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
Example 1:
Input: LRUCache(2);
cache.put(1, 1);
cache.put(2, 2);
cache.get(1);
Output: 1;
Example 2:
Input: cache.put(3, 3); // LRU key was 2, evicts key 2
cache.get(2);
Output: -1;
Constraints:
- capacity is a positive integer.
- All keys and values are in the range of 1 to 10000.
- The functions get and put are guaranteed to be called on existing keys.
system design Senior api design #2

2. [OA] Design User Preferences — Model user preferences for ByteDance's recommendation system

ByteDance aims to provide users with a highly personalized experience based on their preferences. You need to design a class to manage and query user preferences effectively.
Class Name: UserPreferences
- Method Signature: def add_preference(self, category: str, preference: str) -> None
- Adds a preference to the user's profile.
- Method Signature: def get_preferences(self, category: str) -> List[str]
- Returns a list of preferences for a given category.
- Method Signature: def delete_preference(self, category: str, preference: str) -> None
- Deletes a specific preference from a given category.
Example 1:
Input: user_prefs = UserPreferences() ;
user_prefs.add_preference('music', 'rock')
user_prefs.get_preferences('music')
Output: ['rock']
Example 2:
Input: user_prefs.add_preference('music', 'pop') ;
user_prefs.get_preferences('music')
Output: ['rock', 'pop']
Constraints:
- 1 <= len(category) <= 100
- 1 <= len(preference) <= 100
- The same preference may not be added multiple times within the same category.

Related ByteDance Software Engineer interview prep

Start practicing ByteDance questions

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

Get Started Free