Check Whether a Store Is Open With Overnight Weekly Hours

Last updated: November 29, 2026

Quick Overview

Given a store's weekly hours as (day, open_minute, close_minute) rows where a close earlier than the open means the window runs past midnight, build a structure that answers whether the store is open at a given day and minute.

DoorDash
Coding & Algorithms
Software Engineer
DoorDash
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given a store's weekly hours as (day, open_minute, close_minute) rows where a close earlier than the open means the window runs past midnight, build a structure that answers whether the store is open at a given day and minute.

Store hours are a classic source of bugs at DoorDash: late-night restaurants close after midnight, some have split lunch and dinner windows, and Sunday night wraps into Monday. Interviewers use this to check interval normalization, merging overlaps, and binary search for fast lookups.

What the Interviewer Expects
  • Convert every row to minutes since the start of the week
  • Handle the overnight case and the Sunday to Monday wraparound
  • Merge overlapping or adjacent intervals
  • Answer queries with binary search
  • Decide what equal open and close times mean
Key Topics to Cover
intervals
merging
binary search
time normalization
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How do time zones and daylight saving change your representation?
  • How would you add holiday overrides that close or extend specific dates?
  • How would you compute the next opening time for a closed store?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Days 0 (Mon) to 6 (Sun); minutes 0 to 1439.
  • close <= open means the window ends on the next day. open == close means open 24 hours.
  • Intervals are half-open [open, close), so a store closin...
High-Level Design

Map each row to a week-minute start day*1440 + open and length (close - open) % 1440, with zero length meaning a full day. If the end passes 10080 (the end of the week), split it into `[start, 100...


Submit Your Answer
Markdown supported