FastPrepEvenly Schedule Vehicle Inspections
Problems/Evenly Schedule Vehicle Inspections

Evenly Schedule Vehicle Inspections

Amazon logoAmazon● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon full-time phone screen. The report gives a registration cycle of six months, holiday closures, one-hour slots, the window from 10 a.m. to 4 p.m., and the follow-up window from 11 a.m. to 3 p.m. It does not define how far ahead the calendar goes, or a tie rule for evenness. Our version is about 80% the same as the reported question.

Vehicles need an inspection registration every six months. A registration office is closed on holidays. Its standard daily window is 10 a.m. to 4 p.m., and each vehicle takes one one-hour slot. A follow-up question changes the window to 11 a.m. to 3 p.m.

Here you schedule one waiting batch of n vehicles. You plan over dayCount days in a row, numbered from 0. The array holidays lists the day numbers when the office is closed. Every other day is open. On an open day, slots start at each whole hour openHour, openHour + 1, and so on, stopping before closeHour. So the window [openHour, closeHour) includes openHour but not closeHour. It can be either the standard window or the follow-up window.

Fair distribution

Give each vehicle exactly one slot. Spread the vehicles as evenly as possible over all open days. The vehicle counts of any two open days must differ by at most one. If some days must take one extra vehicle, the earlier open days take the extras. Within a day, fill the earliest slots first.

Return an int[][] of [day, startHour] pairs, sorted by day and then by hour. Vehicle i gets the pair at index i. The input always has enough open slots for all n vehicles.

Function

scheduleVehicleInspections(n: int, dayCount: int, holidays: int[], openHour: int, closeHour: int) → int[][]

Examples

Example 1

n = 8dayCount = 3holidays = [1]openHour = 10closeHour = 16return = [[0,10],[0,11],[0,12],[0,13],[2,10],[2,11],[2,12],[2,13]]

Day 1 is closed. The eight vehicles split evenly between open days 0 and 2, so each receives four registrations using its first four hourly slots.

Example 2

n = 5dayCount = 4holidays = [1]openHour = 11closeHour = 15return = [[0,11],[0,12],[2,11],[2,12],[3,11]]

The vehicles are spread over open days 0, 2, and 3, which get 2, 2, and 1 of them. The earlier days take the extra vehicles. Each day fills its slots from the opening hour, which gives the pairs in the output.

Example 3

n = 0dayCount = 2holidays = [0]openHour = 10closeHour = 16return = []

No vehicles are waiting, so the schedule is empty.

Constraints

  • 0 <= n <= 4,416.
  • 1 <= dayCount <= 184.
  • Each value in holidays is unique and between 0 and dayCount - 1.
  • 0 <= openHour < closeHour <= 24; every slot lasts one hour.
  • The number of available slots across all open days is at least n.

More Amazon Phone Screen questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Search in a Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Second Largest Distinct ElementPHONE SCREEN · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • Minimum Operations to Make Every Array Element OneOtter.ai · PHONE SCREENOtter.ai interview questions
  • Climb Detection with Recoverable DipsStrava · PHONE SCREEN
  • Implement Cross-Entropy LossOpenAI · PHONE SCREENOpenAI interview questions
  • Cumulative No-Intercept Regression BetasCitadel · PHONE SCREENCitadel interview questions
  • Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
  • Experiment Bucket Allocation and RebalancingPinterest · PHONE SCREENPinterest interview questions
  • Automation Pipeline, Part 3: Stage DurationPlaid · PHONE SCREENPlaid interview questions
  • Generate an Optimal Portfolio Trading ReportPoint72 · PHONE SCREENPoint72 interview questions

Interview reports that mention this question

  • Amazon Full-Time Interview Timelines: 9 Experiences (Part 2 of 2)
  • Amazon Full-Time SDE Interviews: 9 Experiences (Part 1 of 2)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int[][] scheduleVehicleInspections(int n, int dayCount, int[] holidays, int openHour, int closeHour) {
        // Write your code here
    }

}
Checking account…