← 返回 stripe 的题目列表Deployment Window Scheduler (OA)
类型:qbank
Build a deployment-window scheduler over a recurring 10,080-minute week. First compute the union of allowed intervals minus all freeze intervals; then support per-window timezone offsets, cross-week wrapping, a lead-time cutoff, a minimum continuous duration, and a limit on returned windows.
Requirements
Time is represented as minutes in a recurring week: 0 is Monday 00:00 and 10079 is Sunday 23:59. Every interval is half-open: [start, end).
Parse CSV rows whose Part 1 shape is start,end,type, where type is either allowed or freeze.
Return every continuous deployable interval in ascending start-time order. A time is deployable only when it belongs to at least one allowed interval and no freeze interval.
Merge overlapping allowed intervals, overlapping freeze intervals, and adjacent deployable output intervals.
Part 2 begins with utc_now,lead_time_minutes,min_continuous_minutes,k. Each following row has the shape start,end,type,timezone_offset_minutes.
Convert local interval endpoints with UTC = local_time - timezone_offset_minutes. Timezone conversion can move an endpoint across the 10,080-minute week boundary.
Apply the earliest-start cutoff utc_now + lead_time_minutes, discard output intervals shorter than min_continuous_minutes, sort by UTC start time, and return at most k intervals.
Clarify how wrapped intervals should be represented and how the cutoff behaves when it crosses the week boundary before choosing a normalization strategy.
Examples
Part 1 — freeze splits an allowed interval
part = "part1"
inputCsv = [
"540,600,allowed",
"570,585,freeze"
]
Output:
[
[540, 570],
[585, 600]
]
Part 2 — timezone conversion and duration filtering
part = "part2"
inputCsv = [
"1020,0,10,5",
"540,600,allowed,-480",
"550,565,freeze,-480"
]
The local intervals convert to an allowed UTC interval [1020,1080) and a freeze interval [1030,1045). Both remaining windows satisfy the ten-minute minimum, so the output is:
[
[1020, 1030],
[1045, 1080]
]
Notes
Treat half-open endpoints consistently; touching intervals can be merged without double-counting a minute.
Do not assume that splitting a Sunday-to-Monday window creates two independent windows for minimum-duration filtering. Confirm whether continuity across the week boundary must be preserved.
Likewise, confirm whether results after a cutoff near the end of the week use normalized week-minute coordinates or an unrolled chronological timeline. The available prompt details do not define this behavior.
Preparation
Implement Part 1 with interval merging and subtraction, then test touching endpoints, a freeze that fully covers an allowed window, and freezes outside all allowed windows.
For Part 2, write separate tests for positive and negative timezone offsets that cross the week boundary. Before coding the cutoff path, state an explicit contract for wrapped continuity and output coordinates instead of silently choosing one.