FastPrepTask Scheduler with Cooldown
Problems/Task Scheduler with Cooldown

Task Scheduler with Cooldown

Teradata logoTeradata● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Teradata report describes a well-known task. We chose the function signature, a fixed order for the output, and the input limits. Our version is about 98% the same as the reported question.

Each task takes one time unit. You may execute tasks in any order or remain idle, but two executions of the same task ID must have at least cooldown intervening time units.

Return the minimum total number of time units needed to execute every task.

Function

leastInterval(tasks: String[], cooldown: int) → int

Examples

Example 1

tasks = ["A","A","A","B","B","B"]cooldown = 2return = 8

A B idle A B idle A B is optimal.

Example 2

tasks = ["A","A","A","B","B","B"]cooldown = 0return = 6

No cooldown requires no idle time.

Example 3

tasks = ["A","A","A","B","B","B","C","C"]cooldown = 2return = 8

C tasks fill both idle positions.

Constraints

  • 1 <= tasks.length <= 100000.
  • Task IDs are non-empty uppercase ASCII strings of at most 20 characters.
  • 0 <= cooldown <= 100000.

Source note: Author-written prompt excerpt retained for source fidelity.

More Teradata interview questions

  • Trapping Rain WaterONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Find the Original Array From a Doubled ArrayGoogle · PHONE SCREENGoogle interview questions
  • Future-Aware Cache EvictionBenchling · PHONE SCREENBenchling interview questions
  • Cinema Seat AllocationZillow · PHONE SCREENZillow interview questions
  • Task Scheduler with CooldownSambaNova Systems · PHONE SCREEN · ONSITE INTERVIEWSambaNova Systems interview questions
  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
  • Minimum Distinct Prefix CostChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Nickname-Constrained GroupingZoox · ONSITE INTERVIEW
  • 🐘 Keep Them Apart 🦙QRT · OA
See Teradata hiring insights
Saved
class Solution {
    public int leastInterval(String[] tasks, int cooldown) {
        // write your code here
    }
}
Checking account…