PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Google

Compute servers needed for daily recurring jobs

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of interval-based resource allocation and job grouping by identifier, testing competency in managing overlapping time intervals, capacity planning, and handling day-boundary truncation.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Compute servers needed for daily recurring jobs

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You operate a cluster of identical servers that run recurring **daily** jobs. For a single day, you are given a list of job execution intervals. Each interval has: - `job_id` (string or integer), - `start_time` (timestamp within that day), - `end_time` (timestamp within that day), with `start_time < end_time`. Interpret each interval as a half-open time range `[start_time, end_time)` during which that job must be running on some server **on that day**. Rules and constraints: - Each physical server can execute at most **one job at a time**. - However, if multiple intervals in the input correspond to the **same `job_id`**, they may overlap in time **on the same server** (they are considered parts or retries of the same job and do not consume extra capacity). - If a job's true execution would extend past midnight into the next day, it is conceptually **truncated at the end of the current day** for scheduling purposes; for each day you only see the portion that falls within that day’s 24-hour window. ### Tasks 1. Given all job intervals for a single day (potentially with repeated `job_id`s and overlapping intervals), compute the **minimum number of servers** required to schedule all the jobs under the above rules. 2. Describe the time and space complexity of your algorithm in terms of the number of intervals \(m\). ### Follow-up Some rare jobs are extremely long-running and conceptually span **multiple days** without restart. For such a multi-day job, you decide to reserve a **dedicated server** that is not shared with any other jobs, but which may still handle different intervals of that same `job_id`. Explain how you would extend or adapt your solution to: - Detect which jobs require a dedicated server based on their multi-day duration or configuration. - Account for these dedicated servers when computing the total number of servers needed for the system.

Quick Answer: This question evaluates understanding of interval-based resource allocation and job grouping by identifier, testing competency in managing overlapping time intervals, capacity planning, and handling day-boundary truncation.

Related Interview Questions

  • Find Containing Range - Google (medium)
  • Rearrange Tasks With Cooldown - Google (medium)
  • Solve Three Array and Matrix Path Problems - Google (medium)
  • Consolidate On-Call Rotation Segments - Google (medium)
  • Solve Flower Placement and Directory Deletion - Google (medium)
Google logo
Google
Nov 5, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
9
0

You operate a cluster of identical servers that run recurring daily jobs.

For a single day, you are given a list of job execution intervals. Each interval has:

  • job_id (string or integer),
  • start_time (timestamp within that day),
  • end_time (timestamp within that day), with start_time < end_time .

Interpret each interval as a half-open time range [start_time, end_time) during which that job must be running on some server on that day.

Rules and constraints:

  • Each physical server can execute at most one job at a time .
  • However, if multiple intervals in the input correspond to the same job_id , they may overlap in time on the same server (they are considered parts or retries of the same job and do not consume extra capacity).
  • If a job's true execution would extend past midnight into the next day, it is conceptually truncated at the end of the current day for scheduling purposes; for each day you only see the portion that falls within that day’s 24-hour window.

Tasks

  1. Given all job intervals for a single day (potentially with repeated job_id s and overlapping intervals), compute the minimum number of servers required to schedule all the jobs under the above rules.
  2. Describe the time and space complexity of your algorithm in terms of the number of intervals mmm .

Follow-up

Some rare jobs are extremely long-running and conceptually span multiple days without restart. For such a multi-day job, you decide to reserve a dedicated server that is not shared with any other jobs, but which may still handle different intervals of that same job_id.

Explain how you would extend or adapt your solution to:

  • Detect which jobs require a dedicated server based on their multi-day duration or configuration.
  • Account for these dedicated servers when computing the total number of servers needed for the system.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.