FastPrepPriority Job Scheduler with Cooldowns
Problems/Priority Job Scheduler with Cooldowns

Priority Job Scheduler with Cooldowns

Google logoGoogle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes a priority scheduler with addJob and getJob, followed by a delay rule for each job. It does not give tie handling, empty results, lifecycle details, or an interface that can run anywhere. Our version is about 93% the same as the reported question.

Simulate a scheduler over the finite sequence in operations. Each operation is one of:

  • ADD id priority cooldown: register one persistent job with a unique lowercase identifier, integer priority, and nonnegative cooldown.
  • GET: return the eligible job with the greatest priority. If several eligible jobs have the same priority, return the lexicographically smallest identifier. If no job is eligible, return NONE.

Only GET operations advance scheduler time. A newly added job is eligible immediately. After a job is returned by a GET, it remains registered but is ineligible for its next cooldown intervening GET operations. For example, if a job with cooldown 3 is returned on one call, three later GET calls must occur before it can be returned again. A GET that returns NONE still counts as an intervening call.

Return the result of every GET operation in order.

Function

runPriorityScheduler(operations: String[]) → String[]

Examples

Example 1

operations = ["ADD A 10 3","ADD B 5 0","GET","GET","GET","GET","GET"]return = ["A","B","B","B","A"]

Job A wins the first call by priority. Its cooldown requires calls two, three, and four to intervene, so A becomes eligible again on call five. Job B has cooldown 0 and fills the intervening calls.

Example 2

operations = ["GET","ADD beta 7 1","ADD alpha 7 2","GET","GET","GET","GET"]return = ["NONE","alpha","beta","NONE","alpha"]

The first call has no registered jobs. On the next call, alpha wins the priority tie lexicographically. It needs two intervening calls, while beta needs one after being selected. Both are cooling on the fourth overall GET, and alpha returns on the fifth.

Constraints

  • 1 <= operations.length <= 100000
  • Every operation is exactly GET or has the form ADD id priority cooldown.
  • Each identifier contains 1 through 20 lowercase English letters and is added exactly once.
  • 0 <= priority <= 10^9
  • 0 <= cooldown <= operations.length

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

  • Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
  • Thread-Safe Task Storage and Worker DispatchNuro · ONSITE INTERVIEWNuro interview questions
  • Notification Deduplication WindowGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Helpdesk Ticket ProcessingThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • Execute Tasks by PrioritySnowflake · ONSITE INTERVIEWSnowflake interview questions
  • 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Tiered Expiring Item StoreHudson River Trading · PHONE SCREEN · ONSITE INTERVIEWHudson River Trading interview questions
  • Expiring Key SetAmazon · ONSITE INTERVIEW
  • Key-Value Store on a Block DeviceLambda · PHONE SCREEN

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
  • Google L4 SWE Phone Screen and Kirkland Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] runPriorityScheduler(String[] operations) {
        // Write your code here.
    }
}
Checking account…