Skip to content

Repository files navigation

Low-Level Design — Interview Prep

A collection of classic LLD problems solved in Python, scoped for a 45-minute interview round. Each folder contains a design.py with the implementation and a Readme.md with the problem description, scope, and patterns used.


Problems

# Problem Patterns Used
1 Car Rental System Strategy, Factory, Observer, Singleton
2 Parking Lot Strategy (fee + payment), Factory, Composition
3 Chess Game Template Method, Factory, Singleton
4 Elevator Strategy (scheduling), Observer, Command
5 Snake and Food Game Template Method, Strategy, Factory
6 Tic Tac Toe Game Strategy, Factory, Observer
7 File System Composite, Singleton
8 Rate Limiter Strategy, Factory
9 Splitwise Strategy, Factory, Observer
10 Resource Lease System FIFO Deque, Lazy Deletion, Thread Safety
11 Movie Booking System Strategy, Abstract Provider, Thread Safety

Design Patterns

# Pattern Folder
1 Singleton Pattern Explanation + code examples

Common Design Patterns Across Problems

Pattern Where It Appears
Strategy Payment methods (Car Rental, Parking Lot), player input (Snake, Tic Tac Toe), elevator scheduling, rate limiter algorithms, expense splitting (Splitwise)
Factory Vehicle creation (Car Rental, Parking Lot), piece creation (Chess), player creation (Snake, Tic Tac Toe), rate limiter creation
Observer Booking notifications (Car Rental), floor display (Elevator), game state changes (Tic Tac Toe), balance updates (Splitwise)
Singleton System entry point (Car Rental), Board (Chess), FileSystem
Template Method Piece movement validation (Chess), snake move handling (Snake)
Composite File/Directory hierarchy (File System)
Command Elevator requests (Elevator)
FIFO Deque + Lazy Deletion O(1) amortised token expiry (Resource Lease System)
Threading Lock Thread-safe token grant / release (Resource Lease System, Rate Limiter, Movie Booking System)
Provider (Abstract Factory variant) Pluggable lock backend (Movie Booking System)

How to Use

  1. Pick a problem and read its Readme.md for scope and interview strategy.
  2. Open design.py — code is ordered top-down (enums → models → services → orchestrator).
  3. Look for # TODO: comments — these mark features intentionally left out of scope for a 45-min round but worth mentioning verbally to the interviewer.
  4. Practice explaining class relationships and pattern choices out loud — that's what interviewers evaluate.

About

Low Level Design problems in Python — class diagrams, design patterns, and thread-safe implementations for interview prep.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages