Design 64-bit distributed IDs and a parking lot
FlipsterSoftware Engineer · Technical ScreenLast updated
The question evaluates distributed-systems and scalability competencies for globally unique 64-bit ID generation (including sharding, time-ordering, fault tolerance and clock issues) as well as object-oriented design, concurrency control, API design, and data modeling for a parking lot backend.
You have two system-design prompts.
1) 64-bit database ID generator
Design a service/library that generates globally unique 64-bit integer IDs for database records in a distributed system.
Requirements
- IDs must be unique across all shards/regions.
- Very high write rate (assume 100K–1M IDs/sec globally).
- Prefer IDs that are roughly time-ordered to reduce index fragmentation.
- Support sharding and growth in number of nodes.
- Discuss how to avoid conflicts and what happens on failures (node restart, clock issues, network partitions).
Deliverables
- Bit layout proposal (what each bit range means).
- How nodes obtain any needed configuration (e.g., worker IDs).
- How the system behaves under clock skew/rollback.
- Operational considerations (monitoring, rotation, migrations).
2) Parking lot system (object-oriented + backend)
Design a parking lot management system.
Requirements (assume typical)
- Multiple levels; each level has multiple spots of different types (compact/large/EV/handicapped).
- Vehicles arrive/leave; system issues a ticket and calculates fees.
- Track spot availability and prevent double-allocation under concurrency.
- Provide APIs for: entering, exiting, querying availability, and (optionally) reserving a spot.
Deliverables
- Core classes/entities and relationships.
- Key APIs and data storage approach.
- Concurrency/consistency approach for assigning/freeing spots.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.