Amazon | AWS | SDE2 role

amazon logo
amazon
· SDE II
May 11, 2026 · 3 reads

Summary

I had a phone screen round with Amazon AWS where I was asked one coding question related to task scheduling with dependencies and cooldown constraints.

Full Experience

Hi,
This was the question asked to me today in AWS phone screen round :

You are given n tasks. Each task has:

  • A type (string/character)
  • A list of dependencies (other tasks that must finish first)

Rules:

  1. Each task takes 1 unit of time to execute.
  2. Tasks of the same type must be separated by a cooldown of k units (i.e., after executing a task of type X at time t, the next task of type X can only run at time ≥ t + k + 1).
  3. A task is ready only after all its dependencies have completed.
  4. If no task is ready or all ready tasks are blocked by cooldown, time advances (idle).

Find the minimum time to complete all the tasks.

example :
{t1 -> "A",
t2->"A",
t3->"B",
t4->"A",
t5->"B"}
dependencies : {[t3,t1], [t4, t2]}
cooldown : 2

result : 7

Interview Questions (1)

1.

Task Scheduling with Dependencies and Cooldown

Data Structures & Algorithms·Hard

You are given n tasks. Each task has:

  • A type (string/character)
  • A list of dependencies (other tasks that must finish first)

Rules:

  1. Each task takes 1 unit of time to execute.
  2. Tasks of the same type must be separated by a cooldown of k units (i.e., after executing a task of type X at time t, the next task of type X can only run at time ≥ t + k + 1).
  3. A task is ready only after all its dependencies have completed.
  4. If no task is ready or all ready tasks are blocked by cooldown, time advances (idle).

Find the minimum time to complete all the tasks.

Example:
Tasks: {t1 → "A", t2→"A", t3→"B", t4→"A", t5→"B"}
Dependencies: {[t3,t1], [t4, t2]}
Cooldown: 2
Result: 7

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!