Back to problems

Query Store Opening Hours with Weekly and Overnight Schedules

Algorithm · Apple · Medium

Write a program that answers queries about a store's opening hours: for a given weekday and time of day, decide whether the store is open. In the original interview the requirements were layered on one after another: Decide whether a query time lies inside a single opening interval. Limit opening to certain weekdays only, for example Monday to Friday. Permit several intervals per day, with the same set of intervals used on every chosen weekday, for example 08:00–10:00…

Loading the rest of the question…