PayPal's "BookMyShow (Ticket Search and Payment)" interview question focuses on low-level design (LLD) for a movie ticket booking system, tagged for backend, web, and system design roles. It emphasizes implementing core functionalities like cinema management, show scheduling, ticket booking/cancellation, and search features using OOP principles and design patterns.
Design a movie ticket booking system similar to BookMyShow. Key requirements include:
Typical implementation involves these entities (based on standard LLD approaches for this problem):
Observer Pattern Usage: ShowManager notifies CityMovieSearchService and HallMovieSearchService on new show additions to keep search indexes updated.[1]
No official full I/O test cases exist (as it's an LLD whiteboard/OA problem), but standard API signatures from practice implementations include:
| Method | Input | Output | Description |
|--------|-------|--------|-------------|
| addCinemaHall(hallId, name, rows, cols) | hallId: String, name: String, rows: int, cols: int | boolean (success) | Creates hall with seat matrix. |
| addShow(hallId, movieId, startTime, duration) | hallId: String, movieId: String, startTime: long, duration: int | ShowId: String | Adds show; notifies observers. Example: Input ("H1", "M1", 1640000000L, 120) → "S1" [1] |
| bookTickets(userId, showId, seatIds[]) | userId: String, showId: String, seatIds: List<String> | Booking or null (if unavailable) | Locks and books seats. Example: Input ("U1", "S1", ["A1", "A2"]) → Booking{bookingId: "B1", status: "CONFIRMED"} [3] |
| cancelBooking(bookingId) | bookingId: String | boolean | Frees seats. |
| getCinemasByCityMovie(city, movieName) | city: String, movieName: String | List<CinemaHall> | Search example: Input ("Mumbai", "Avengers") → ["PVR1", "INOX2"] [1][3] |
| getShowsByHallMovie(hallId, movieName) | hallId: String, movieName: String | List<Show> | Search example: Input ("H1", "Avengers") → [Show{S1: 6PM}, Show{S2: 9PM}] [1] |
| blockSeatsTemp(seatIds[], userId) | seatIds: List<String>, userId: String | Timeout: int (e.g., 600s) | Holds seats for payment window. Example from similar: → "Seats blocked for 10 mins" [3] |
Practice links from sources point to detailed coding: e.g., Codezym Q10 for full implementation.[1]