Design split-stay combinations API
Company: Airbnb
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design an HTTP API endpoint that, given a date range [S, E] and a collection of listings with availability as arrays of day numbers, returns all two-listing split-stay combinations that together cover the entire range with consecutive subsegments (first listing covers S..T, second covers T+1..E for some T). Define the request and response schemas (including how listings are identified), pagination and result ordering, deduplication of unordered pairs, validation and error handling, and filters (e.g., minimum stay lengths). Discuss performance targets and system concerns such as indexing/precomputing maximal consecutive intervals, query flow, caching, consistency model, idempotency, rate limiting, and SLAs. Include how the endpoint would produce [["B","C"]] for the sample data A:[1,2,3,6,7,10,11], B:[3,4,5,6,8,9,10,13], C:[7,8,9,10,11] with date range [3,11].
Quick Answer: The question evaluates API and system design competence, including data modeling for availability intervals, request/response schema design, deterministic pagination and ordering, deduplication of unordered listing pairs, validation/error handling, and performance considerations such as indexing, precomputation, caching, and SLAs.