← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Uber SWE interview with a classic OOP design problem. Not as straightforward as it sounds once you get into the spot assignment logic and complexity analysis.

Questions Asked (1)

Q1

Design and implement a parking lot system with park, unpark, and checkcar methods. Motorcycle spots fit only motorcycles; regular spots fit motorcycles or cars. Define your class structure (ParkingLot, Spot, Vehicle types) and analyze the time complexity of each method.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with the classes fine but the spot assignment logic tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and assumptions (e.g., spot sizes, vehicle types, concurrency). Then design a class hierarchy with ParkingLot, Spot, and Vehicle, and implement park/unpark/checkcar using appropriate data structures. Finally, analyze time complexity for each method and discuss trade-offs.

Pro tip: Mention that using a min-heap of available spots per size can optimize park to O(log n), but a simple list is O(n); always state your assumptions and justify your data structure choices.

1. Clarify Requirements

Ask about spot sizes, vehicle types, concurrency, and expected operations. Confirm whether checkcar means checking if a specific car is parked or checking availability.

2. Define Class Structure

Outline classes: Vehicle (abstract, with subclasses Motorcycle, Car), Spot (with size and occupied status), and ParkingLot (managing spots and vehicles).

3. Implement Core Methods

Implement park(vehicle) to find a suitable spot, unpark(vehicle) to free a spot, and checkcar(vehicle) to verify if the vehicle is parked.

4. Analyze Time Complexity

For each method, derive Big-O complexity based on data structures used (e.g., list scan O(n), heap O(log n)). Discuss trade-offs.

5. Discuss Extensions and Trade-offs

Mention scalability, concurrency, and alternative designs (e.g., using hash maps for quick lookup).

Key Points to Mention

  • Class hierarchy: Vehicle (abstract) with Motorcycle and Car subclasses; Spot with size (Motorcycle, Regular) and occupied flag; ParkingLot with collections of spots.
  • Spot assignment logic: Motorcycle can park in Motorcycle or Regular spots; Car only in Regular spots.
  • Data structures: Use lists or heaps for available spots; hash map for vehicle-to-spot mapping for O(1) checkcar and unpark.
  • Time complexity: park O(n) with list scan, O(log n) with heap; unpark O(1) with hash map; checkcar O(1) with hash map.
  • Concurrency considerations: Use locks or concurrent data structures for thread safety.
  • Trade-offs: Simplicity vs. performance; memory vs. speed; handling of edge cases like full lot.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.