cswork / libraryOpen practice workspace

Interview questions · StubHub

Build Event Notification Engine

This question evaluates a candidate's competency in modular software design and extensibility, algorithmic filtering and ranking, date arithmetic for birthday proximity, geospatial distance computation, and integration with notification services.

You are implementing part of a marketing engine for an event marketplace.

Assume the following data is available:

  • Customer: id, city, birth_month, birth_day, latitude, longitude
  • Event: id, title, city, start_time, latitude, longitude
  • NotificationService.send(customer_id, message) sends a notification to a customer

Implement a MarketingEngine with a method such as send_customer_notifications(customer, events, today).

The engine should support multiple campaigns:

  1. Notify the customer about all upcoming events in the same city as the customer.
  2. Notify the customer about the single upcoming event whose date is closest to the customer's next birthday after today.
  3. Notify the customer about the 5 upcoming events closest to the customer by geographic distance. For this interview, you may use Euclidean distance on latitude and longitude.

Design the code so that new campaigns can be added without changing the core engine. Also explain how you would handle ties, fewer than 5 matching events, and notification formatting.

Community answers

Nothing here yet.

Join in on CSWork →