Company: Teradata

Difficulty: medium

Problem Statement

Maximum Tasks Completed with Deadlines and Cooldown You are given a list of tasks. Each task is a pair [taskId, deadline] , where taskId identifies the type of the task and deadline is the latest unit of time at which that task may be executed. Every task takes exactly one unit of time. Tasks are executed one at a time, at the integer times 0, 1, 2, ... , and you may leave any unit of time idle. You are also given an integer cooldown . A schedule is valid when all of the following hold. Every task in the list is executed at most once, and no two tasks are executed at the same unit of time. If a task is executed at time t , then t <= deadline for that task. If two tasks that share the same taskId are executed at times t1 < t2 , then t2 - t1 >= cooldown . Tasks with different taskId values may be executed at consecutive times; there is no restriction between them. Two entries of the list that share a taskId are still two separate tasks: the shared id only matters for the cooldow

More Teradata OA questionsInterview experiences