Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Interview Experiences
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Detect Anomalous Days in Hotel Reservations

Given a list of hotel reservations with check-in and check-out days, compute the number of active reservations per day and identify anomalous days where the active count drops below 80% of the rolling 7-day average. Return all anomalous days in ascending order.

Asked at:

B

Booking.com


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Late February, 2026

B

Booking.com

Senior

Here is the **full interview question** written cleanly, exactly how you can expect it (or present it): --- ## 📌 Problem: Detect Anomaly Days in Reservation Data You are given data about hotel reservations. Each reservation consists of: * `reservationId[i]`: a unique identifier * `checkins[i]`: the check-in day (integer) * `checkouts[i]`: the check-out day (integer) A reservation is considered **active** on a given day `d` if: ``` checkins[i] <= d < checkouts[i] ``` (Note: the checkout day is **exclusive**.) --- ## 📌 Task For each day in the overall date range, compute the number of **active reservations**. A day `d` is considered an **anomaly day** if: ``` active[d] < 0.8 * average(active[d-7], active[d-6], ..., active[d-1]) ``` ### Important: * Only evaluate a day if there are **at least 7 previous days available**. * The average is calculated over the **previous 7 days only**. --- ## 📌 Function Signature ```python def detectAnomalyDays(reservationIds, checkins, checkouts): ``` --- ## 📌 Requirements * Return a list of anomaly days in **ascending order** * Use an **efficient algorithm** * Avoid unnecessary recomputation * Be mindful of large date ranges --- ## 📌 Example ```python reservationIds = [123, 435, 444, 532, 232, 221] checkins = [0, 3, 2, 5, 9, 10] checkouts = [6, 7, 13, 9, 12, 12] ``` ### Output ```python [8, 9, 12, 13] ``` --- ## 📌 Notes / Edge Cases * Ignore invalid reservations where `checkin >= checkout` * Days with no active reservations should still be considered * The date range is from the **minimum check-in** to the **maximum check-out** * The solution should ideally run in **O(N + D)** where: * `N` = number of reservations * `D` = number of days in the range --- If you want, I can also give you: * The **exact wording Booking.com uses** * Or a **harder follow-up version** (they often ask it)

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.