FastPrepMinimum Servers for Cyclic Daily Tasks
Problems/Minimum Servers for Cyclic Daily Tasks

Minimum Servers for Cyclic Daily Tasks

Google logoGoogle● MediumINTERNNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The firsthand Google internship report asks for the minimum servers for tasks that start within a 24-hour cycle and may cross midnight. Its example mixes hour-like start labels with minute durations, so FastPrep normalizes every start to minutes after midnight, treats tasks as daily repeating half-open intervals, and uses a 1,440-minute day.

A daily schedule contains tasks represented as [startMinute, duration]. Each task starts at startMinute minutes after midnight, runs continuously for duration minutes, and repeats at the same time every day. A task may cross midnight.

One server can run at most one task at a time. Intervals are half-open: when one task ends at minute t, the same server may run a task that starts at minute t. Return the minimum number of servers needed to run the repeating schedule.

Function

minDailyServers(tasks: int[][]) → int

Examples

Example 1

tasks = [[1380,60],[0,30],[1380,30]]return = 2

The two tasks starting at 23:00 overlap, so two servers are necessary. The 60-minute task ends exactly at midnight, when the 00:00 task begins, so they may reuse a server.

Example 2

tasks = [[1430,30],[5,20],[30,10]]return = 2

The first task wraps through minute 20 and overlaps the task from minute 5 to 25. The third task starts later.

Example 3

tasks = [[100,1440],[200,10],[210,10]]return = 2

The full-day task is always active. The two shorter half-open tasks do not overlap each other, so one additional server is enough.

Constraints

  • 1 <= tasks.length <= 200000
  • Every task is [startMinute, duration].
  • 0 <= startMinute < 1440.
  • 1 <= duration <= 1440.

More Google Onsite Interview questions

  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Filesystem Entity Total SizeONSITE INTERVIEW · Seen Nov 2026
  • Longest Subarray Within an Absolute-Difference LimitONSITE INTERVIEW · Seen Nov 2026
  • Reach a Destination Through Scheduled FlightsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Query Weekly Store Opening HoursApple · PHONE SCREENApple interview questions
  • Longest Uninterrupted Work BlockIntuit · PHONE SCREENIntuit interview questions
  • Calendar Event System with Pagination and IntersectionLead Bank · ONSITE INTERVIEWLead Bank interview questions
  • Worker Management with Promotions and Double-Paid TimeInstacart · ONSITE INTERVIEWInstacart interview questions
  • Track Received Byte RangesRoblox · OARoblox interview questions
  • Deployment Window SchedulerStripe · OAStripe interview questions
  • Worker Management (Promotion Track), Part 4: Full-Shift Double PayAirbnb · OAAirbnb interview questions
  • Worker Management, Part 4: Double-Paid IntervalsAnthropic · OAAnthropic interview questions
  • Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions

Interview reports that mention this question

  • Google SWE and PhD Intern Coding: 14 Experiences (Part 3 of 3)

Google interview experiences

  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
  • Google AI Coding Interview and AI OA: 2 Experiences
  • Google SWE Intern Interview Results Timeline: 13 Experiences
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int minDailyServers(int[][] tasks) {
        // Write your code here.
    }
}
Checking account…