Low-level design#
Standard#
Design a game of chess.
Follow up:
How to implement rules of how different pieces move?
How to know if a piece can move from loc1 to loc2? how does the move happen?
How do you know there’s a checkmate?
Where to keep direction?
Counter Strike.
Requirements:
Two teams, cops and terrorists, each with some players.
Players can have weapons.
Players have a health counter, which goes down based on certain parameters (where was he hit, by what location/weapon etc.).
Assume 2D/grid-like maps. In future, we can add new maps.
Follow up:
How does a player know who all he can shoot?
How do you shoot (as in, what classes interact and how)?
How does player move?
Calendar, with ability to add events, get events for a given day and get details for a given event ID.
Simple#
2-player snakes and ladder.
High level design#
Standard#
A health monitoring system for a huge fleet of machines, with automated alerts and admin UI.
Follow up:
Pull vs push?
Where do you keep thresholds on when to alarm? Can you ensure separate thresholds for same metrics for different people?
APIs
How do you add more metrics in future?
How do you know your system is working fine?
Netflix: based on certain rules, that should be extendable, should user be allowed to watch a title? For e.g., geography, membership type, HD or not etc.
Simple#
A service to ingest and vend out logs, something similar to Timber.
Requirements:
Dedupe data based on something.
Don’t look inside the logs. Ingest as is.
APIs.
Advanced- design the daemon which is doing log rotation on hosts.
Wish list feature on amazon.
Follow up:
How is watchlist stored in backend? RDBMS or NoSQSL?
How would you run into concurrency problems in distributed systems?
Upcoming#
A system to match competitor prices.
Dacia (only if candidate has worked on sqs or other queueing system before)?
Meeting room booking system.
Distributed throttling between a group of machines
IRCTC website?
DJS?
Top 10 trending products.
High and low level design together#
Standard#
Bar exchange where prices go up or down depending on demand.
Requirements:
Multiple tables.
Users can order multiple times.
They should pay the price of item when they ordered.
Decider can be assumed as a black box but think about its input and output data.
Follow up:
How will this work for multiple restaurants?
Inventory validation? Can you blindly take an order and deny later? How do clients know if item is still available?
Can decider be notified of incoming orders?
Do you take price as input from clients (which can be rogue) or store in your system?
System to reserve tables in a restaurant.
Requirements:
For one restaurant, book tables for requested time range and capacity.
All components, such as mobile app with restaurant host, backend, etc.
Follow up:
Database modeling.
Merge tables.
How to extend system to bar stools?
Advanced- how to extend to multiple restaurants?
Upcoming#
Public library, which has lot of branches, allows placing a hold, etc.