Placement prep

LLD and Machine Coding

Design patterns, then full machine-coding builds like a rate limiter, parking lot and elevator.

  • Handwritten-style
  • Diagrams and tables
  • Worked examples

Who this notebook is for

Developers preparing for low level design and machine coding rounds, where you must build working software in about ninety minutes. It assumes you know the basics of object oriented programming.

What you will be able to do

  • Plan a machine coding solution in the time you are given
  • Pick a design pattern that fits a requirement and explain why
  • Build common systems such as a rate limiter, parking lot and key value store
  • Make a design safe when several threads use it at once

What's inside

Pick a chapter and the notebook opens right there.

  1. LLD Foundations & Clean ArchitectureMachine Coding Demystified, 90-Min Timeline, SOLID Principles, Clean Layering, Pivot Defense, Driver CodeStart here
  2. OO Analysis & UML ModelingDomain Modeling, Class Diagrams, Association vs Composition, State Machine Diagrams, CRC Cards, Anemic AvoidanceStart here
  3. Creational Design PatternsSimple vs Factory Method, Abstract Factory Families, Fluent Builder Invariants, Thread-Safe Bill Pugh Singleton, PrototypeStart here
  4. Structural Patterns & CompositionAdapter Wrapper, Decorator Subclass Elimination, Facade Subsystem Orchestration, Composite Tree Semantics, Proxy RBACStart here
  5. Behavioral Patterns & StateStrategy Algorithm Injection, Observer Pub/Sub Fan-Out, State Machine Lifecycle, Command Undo/Redo, Chain of ResponsibilityStart here
  6. Concurrency & Thread-SafetyRace Condition Elimination, ReentrantLock, ConcurrentHashMap Striping, Producer-Consumer BlockingQueue, Optimistic CASStart here
  7. Machine Coding: In- Memory KV StoreCRUD Engine, Dual TTL Eviction (Min-Heap + Passive), Stack-Based Nested Transactions (BEGIN, COMMIT, ROLLBACK), OCCStart here
  8. Machine Coding: Rate LimiterToken Bucket Lazy Refill, Leaky Bucket Shaper, Fixed vs Sliding Window Counter (Cloudflare), Multi-Tier Hierarchies, Redis LuaStart here
  9. Machine Coding: Parking LotMulti-Floor Layout, Nearest-to-Gate Min-Heap Allocation, Vehicle Type Compatibility, Progressive Hourly Slab Billing, GatesStart here
  10. Machine Coding: SplitwiseEqual/Exact/Percent Splits, Factory + Strategy, Greedy Debt Simplification ($O(N \log N)$ Cash Flow), Pairwise LedgersStart here
  11. Machine Coding: Snake & LadderArbitrary $N imes N$ Grid, Polymorphic Jump Entities, Multi/Crooked/Mock Dice, FIFO Queue Turn Management, Portals & MinesStart here
  12. Machine Coding: Tic- Tac-ToeScalable $N imes N$ Grid, Scalable $N imes N$ Grid, O(1) O(1) Counter Array Win Detection, Connect-K Counter Array Win Detection, Connect-K Localized Ray-Casting, Command Undo/Redo, Minimax BotStart here
  13. Machine Coding: Elevator SystemLOOK/SCAN Dual-Priority Queue Scheduling, Multi-Car Dispatcher (Figure of Merit), Autonomous Motor Threads, Fire AlarmStart here
  14. Machine Coding: Movie BookingAuditorium Screening Models, Temporary 10-Min Seat Locking (TTL), Flash-Sale Concurrency Protection, Contiguous Seat FinderStart here
  15. Machine Coding: Task SchedulerTemporal Min-Heap Scheduling, Zero-CPU Condition Variable Sleeping, Dynamic Earlier Task Preemption, Fixed-Rate/Delay, LeasesStart here
  16. Machine Coding: Cricbuzz SystemCricket State Machine, Ball-by-Ball Legal Delivery Accounting, Double Strike Rotation Rules, Observer Commentary Fan-OutStart here
  17. Machine Coding: Logging FrameworkChain of Responsibility Level Filters, Composite Appenders (Console/Rolling File), Sub-Microsecond Async Ring Buffer, PII MaskStart here
  18. FAANG Drills & Staff Rubric5-Pillar Evaluation Rubric, 60-Second Pattern Recognition Drills, Concurrency Trap Audit, 5-Minute Pivot Playbook, 25-Point ChecklistStart here

Practice this

Put it to work on LakeBench.

Common questions

What is a machine coding round?
It is an interview where you write a small but complete program for a real world problem, and the code is judged on structure and whether it runs.
Which language should I follow along in?
Use the language you are strongest in. The designs are shown with class diagrams and clear code, and they translate to Java, C++ or Python.
Can I read a sample before I commit?
Yes. The contents pages and the first pages of every notebook can be read online, so you can judge the style before going further.

More in Placement prep

All notebooks