Airbnb: Pairs of listings that together cover a split stay
Problem. There are n hotels, and each one has a list of the dates it is free. A guest asks for a date range from a start date to an end date. Split that range into two back-to-back segments so that one hotel covers the first segment and a different hotel covers the second. Segments only run forward in time. Return every valid hotel combination, with no duplicates.
What the interviewer cared about. Fully correct, bug-free code that passed every test case live in the session. Correct de-duplication of the returned combinations was a big part of that.
How it went. The candidate first compressed each hotel's free dates into continuous ranges, then tried every possible split point and checked whether some hotel could cover each side. Most of the time went into debugging and removing duplicates, so they never reached the follow-up question, and they felt the solution was not optimal. The result was a rejection at the technical screen.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.