FastPrepQuery Weekly Store Opening Hours
Problems/Query Weekly Store Opening Hours

Query Weekly Store Opening Hours

Apple logoApple● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Apple full-time phone screen. The report adds features step by step: weekday schedules, several open periods in a day, hours that cross midnight, and the Sunday-to-Monday boundary. We chose how days are numbered, that a period includes its start and excludes its end, the array shapes, the examples, and the input limits. Our version is about 84% the same as the reported question.

Given the store's weekly opening intervals openingHours and a list of weekly times queries, return, for each query in order, whether the store is open at that time.

Days are numbered 0 through 6 for Monday through Sunday. Each interval is [startDay, startHour, startMinute, endDay, endHour, endMinute]. The store is open at an interval's start and closed at its end. Each query is [day, hour, minute].

If an interval ends earlier in the week than it starts, it wraps past Sunday into Monday. Intervals may overlap or touch.

Function

queryWeeklyStoreHours(openingHours: int[][], queries: int[][]) → boolean[]

Examples

Example 1

openingHours = [[0,8,0,0,10,0],[0,14,0,0,20,0]]queries = [[0,8,0],[0,12,0],[0,19,59],[0,20,0]]return = [true,false,true,false]

The first and third queries fall inside Monday's two intervals, so the store is open. The second query falls between the intervals, and the fourth is the closed end at 20:00, so the answer is [true,false,true,false].

Example 2

openingHours = [[4,22,0,5,2,0],[6,22,0,0,2,0]]queries = [[5,1,30],[5,2,0],[6,23,0],[0,1,0],[0,2,0]]return = [true,false,true,true,false]

The first interval runs from Friday night into Saturday, so the first query is open and the second is its closed end. The second interval wraps from Sunday night into Monday, so the next two queries are open and the last is its closed end, giving [true,false,true,true,false].

Constraints

  • 0 <= openingHours.length, queries.length <= 100000.
  • Days are in [0,6], hours in [0,23], and minutes in [0,59].
  • An interval's start and end weekly times are different.
  • The schedule repeats every week in one timezone.

More Apple Phone Screen questions

  • Subarray Product Less Than KPHONE SCREEN · Seen Nov 2026
  • Evaluate DivisionPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Validate a BST with a Custom ComparisonPHONE SCREEN · Seen Nov 2026
  • Design a Food Rating SystemPHONE SCREEN · Seen Oct 2026
  • Days Until Poisoned Plants StabilizePHONE SCREEN · Seen Oct 2026
  • Capture Surrounded Regions with Union-FindPHONE SCREEN · Seen Oct 2026
  • Maintain a Consistent-Hashing RingPHONE SCREEN · Seen Oct 2026
  • Count Nodes in a ChainPHONE SCREEN · Seen Oct 2026
  • Run-Length DecodingPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Finish Time of Fixed-Length CPU TasksGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Stream Cluster Max and MedianSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Longest Uninterrupted Work BlockIntuit · PHONE SCREENIntuit interview questions
  • Interview Slot BookingTrueFoundry · PHONE SCREEN
  • Classify Heap Addresses from a Memory SnapshotSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Unexplained Sightings Outside Flight IntervalsMobileCoin · PHONE SCREEN
  • Maximum Profit in Job SchedulingAmazon · PHONE SCREEN
  • Range ModuleWalmart · PHONE SCREENWalmart interview questions
  • Maximum Event Value with an Attendance LimitSnowflake · PHONE SCREENSnowflake interview questions
  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions

Apple interview experiences

  • Apple SWE Phone Screen: Subarray Products: 1 Experience
  • Apple New Grad SWE Java, Coding and Manager Rounds: 1 Experience
  • Apple AI Coding and Related Interviews: 17 Experiences
  • Apple India SWE New Grad Interviews: 5 Experiences
  • Apple New Grad SWE Phone Screens: 12 Experiences (Part 3 of 3)
  • Apple New Grad SWE and Embedded: 16 Experiences (Part 2 of 3)
All Apple interview questionsSee Apple hiring insights
Saved
class Solution {
    public boolean[] queryWeeklyStoreHours(int[][] openingHours, int[][] queries) {
        // Write your code here.
    }
}
Checking account…