AlgoViz

What an LLD interview tests

easy 40 min

A low-level design round gives you one vague sentence and about 45 minutes.

Video lesson · Chapter 1 of 6

Make a prediction

0:00 / 5:00

See it run

The same prompt with and without owners, the lens, and the score sheet.

Operations

The weak class

One class, loose lists, no checks.

Step 1 of 5

A bike is free

ashascreen 1leescreen 2systemBikeSystemb1 statusdockedb1 stationnorthb1 ridernoneb1 startnonesouth docks0

Bike b1 stands at north. Everything about it is in one list.

Step 1: A bike is free

def action(self, kind, rider, station, bike, now):    b = self.bikes[bike]    if kind == "start":        b[0] = "riding"        b[2], b[3] = rider, now        return None    if kind == "finish":        minutes = now - b[3]        b[0], b[1] = "docked", station        return minutes * 20
Shows
Fast typing
Costs
Every rule

Ask for each method: what would make this call wrong, and who says no?

In the real world

The same what an lld interview tests doing real jobs. Pick one and step through it.

The lens on a lending library.

Step 1 of 5

Container

QuestionFound
ContainerWhat holds?Shelf, section
Item
Manager
Policy
Lifecycle

Shelves and sections.

Step 1: Container

Common mistakes

The bugs interviewers watch for, with the fix beside each.

  • Facts as positions

    major

    Nobody knows what index 2 is.

    Wrong
    b[2] = rider
    Right
    Ride(rider, bike, now)
  • Change before check

    critical

    The second caller overwrites the first.

    Wrong
    bike.state = RIDINGbike.rider = rider
    Right
    if bike.state is not DOCKED: raise Refused()bike.move_to(RIDING)
  • Delete before the step that fails

    critical

    A full station leaves a bike without a ride.

    Wrong
    del rides[rider]station.put(bike)
    Right
    station.put(bike)del rides[rider]
  • A pattern without a force

    minor

    It adds names and answers no question.

    Wrong
    class RideFactorySingleton: ...
    Right
    Ride(rider, bike, now)

Interview tips

  • Ask first

    • Main path in one line
    • Who may, what refuses, what varies
    • Read the scope back
  • Name owners

    • One sentence per rule
    • Reject nouns aloud
    • Split a class with many fields
  • Prove it

    • Invariant, then trace
    • One refusal
    • One race
  • Stay small

    • Value before class
    • Enum before State
    • Method before interface