Filter Hotels by Continuous Availability and Compute Prices

Problem Implementation-heavy: given hotels with per-date availability (and nightly prices), a check-in and a check-out date, return the hotels available for EVERY night in the range, along with their total stay price.

Input / Output

  • Input: hotels[], each with available dates -> price; checkIn, checkOut.
  • Output: the eligible hotels with a computed total (or per-night) price.

Constraints

  • Continuous coverage required — availability on [checkIn, checkOut) means every night, checkout day exclusive (state this convention).
  • Many hotels x long ranges, so per-query linear scans of date lists should be improved.

Example

  • Hotel A available Jan 1-5, query Jan 2-4 -> eligible (nights of the 2nd and 3rd).
  • Same hotel, query Jan 4-7 -> not eligible (missing the 5th/6th nights).
asked …
LeaderboardSalaryAccount