Deployment Window Scheduler
Learn this problemProblem statement
Implement scheduleDeploymentWindows for both modes described below. The value of part determines how to read inputCsv and which rules to apply.
Return the resulting deployment windows as [[start, end], ...], sorted by start time.
Common Rules
- A week contains
10080minutes. Minute0is Monday 00:00, and valid weekly minute positions range from0through10079. - Every interval is half-open:
[start, end). - An
allowedinterval permits deployment. Afreezeinterval prohibits deployment.
Part 1
When part is "part1", every row in inputCsv has this format:
start,end,typeCompute the union of all allowed intervals, then subtract the union of all freeze intervals. Allowed intervals may overlap, freeze intervals may overlap, and adjacent deployable intervals must be merged.
Part 2
When part is "part2", the first row in inputCsv contains the global settings:
utc_now,lead_time_minutes,min_continuous_minutes,kEvery remaining row describes a local-time interval:
start,end,type,timezone_offset_minutesProcess Part 2 in this order:
- Convert each local interval to UTC using
UTC = local_time - timezone_offset_minutes. - Normalize converted times modulo
10080. If a converted interval crosses the week boundary, split it into two weekly intervals. - Compute deployable time using the Part 1 allowed-minus-freeze rules.
- Discard every portion before
utc_now + lead_time_minutes. - Keep only remaining intervals whose continuous length is at least
min_continuous_minutes. - Sort the intervals by UTC start time and return at most the first
kintervals.
Function
scheduleDeploymentWindows(part: String, inputCsv: String[]) → int[][]Examples
Example 1
part = "part1"inputCsv = ["540,600,allowed","570,585,freeze"]return = [[540,570],[585,600]]Part 1. The freeze interval removes [570,585) from the allowed interval [540,600).
Example 2
part = "part2"inputCsv = ["1020,0,10,5","540,600,allowed,-480","550,565,freeze,-480"]return = [[1020,1030],[1045,1080]]Part 2. The offset converts the allowed interval to [1020,1080) and the freeze interval to [1030,1045). Both remaining windows are at least 10 minutes long.
Constraints
- Weekly minute values are normalized over a
10080-minute week. - All intervals are half-open.
- Window rows use type
allowedorfreeze.
More Stripe problems
- Directly Linked UsersOA · Seen Jun 2026
- Fraud Ring SizeOA · Seen Jun 2026
- Risky Fraud RingOA · Seen Jun 2026
- Account Balance Manager Part 3 - Platform CoverageONSITE INTERVIEW · Seen Jun 2026
- BitFont Part 3 - Decode Run-Length-Encoded RowsONSITE INTERVIEW · Seen Jun 2026
- Record Linkage Part 3 - Full Connected ComponentPHONE SCREEN · Seen Jun 2026
- Shipping Cost Calculator Part 3 - Mixed Fixed/Incremental TiersONSITE INTERVIEW · Seen Jun 2026
- Transaction Fee Calculator - Per-Merchant Volume DiscountPHONE SCREEN · Seen Jun 2026