FastPrepParallel Courses with Durations
Problems/Parallel Courses with Durations

Parallel Courses with Durations

Citadel logoCitadel● HardINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported by a person applying to a New York software engineering intern role, who interviewed in November 2025. The report lists its technical topics without saying which round each came from. One was a harder version of the classic task about finishing courses that have prerequisites when several courses can run at once.

The report names only the topic. It does not say what made the task harder, and gives no input format, examples or limits. We picked what makes it harder: each course takes its own number of months, so the answer is the earliest month by which every course is done. A cycle in the prerequisites makes the answer -1. The examples and limits are ours.

Our version is about 50% the same as the reported question.

Given an integer n, a 2D integer array relations and an integer array time, return the minimum number of months needed to finish all n courses, or -1 if that is impossible.

The courses are labeled from 1 to n, and course i takes time[i - 1] months. Each relations[j] = [prevCourse, nextCourse] means that course prevCourse must be finished before course nextCourse can start.

A course can start as soon as all of its prerequisites are finished. A course with no prerequisites can start at month 0. You can take any number of courses at the same time.

If the prerequisites contain a cycle, the courses on that cycle can never start, so the answer is -1.

Function

minimumTime(n: int, relations: int[][], time: int[]) → int

Examples

Example 1

n = 5relations = [[1,3],[2,3],[3,5],[2,4]]time = [3,2,6,1,4]return = 13

Courses 1 and 2 start at month 0 and finish at months 3 and 2. Course 3 needs both, so it runs from month 3 to month 9, and course 5 then runs from month 9 to month 13. Course 4 runs from month 2 to month 3, while course 1 is still running.

Example 2

n = 4relations = [[1,2],[2,3],[3,4],[4,2]]time = [2,3,1,4]return = -1

Course 2 needs course 4, course 4 needs course 3, and course 3 needs course 2. These three courses wait for each other in a cycle, so none of them can ever start.

Example 3

n = 4relations = [[1,2],[2,3]]time = [2,2,2,9]return = 9

The chain 1, 2, 3 takes 6 months. Course 4 has no prerequisites, so it runs at the same time and takes 9 months, which is longer.

Constraints

  • 1 <= n <= 10^4
  • 0 <= relations.length <= 2 * 10^4
  • relations[j].length == 2
  • 1 <= prevCourse, nextCourse <= n
  • prevCourse != nextCourse
  • All the pairs [prevCourse, nextCourse] are unique.
  • time.length == n
  • 1 <= time[i] <= 10^4

More Citadel Phone Screen questions

  • Speed Up a Slow FunctionOA · PHONE SCREEN · Seen Nov 2026
  • Portfolio Tickers with Constant-Time Random PickPHONE SCREEN · Seen Nov 2026
  • Square Root FunctionPHONE SCREEN · Seen Oct 2026
  • Reachable Transfer PositionsPHONE SCREEN · Seen Oct 2026
  • Spreadsheet Formula DependenciesPHONE SCREEN · Seen Oct 2026
  • Currency Arbitrage CyclePHONE SCREEN · Seen Sep 2026
  • Order Book with Cancel by Order IDPHONE SCREEN · Seen Sep 2026
  • Smart Queue of Latest PricesPHONE SCREEN · Seen Sep 2026
  • Merge Price-Delta FeedsPHONE SCREEN · Seen Sep 2026
  • Reconcile Unmatched Trades with Timestamp TolerancePHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Select Transactions with Child-Pays-for-Parent PackagesCoinbase · PHONE SCREENCoinbase interview questions
  • Choose a Road to Maximize Average Route Toll IncreaseHarness · PHONE SCREEN
  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Minimum Completion Time for DAG DependenciesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Work Order Critical PathHadrian · PHONE SCREENHadrian interview questions
  • Longest Name Chain in a Directed Acyclic GraphOscar Health · PHONE SCREEN
  • Service Dependency Load FactorsRobinhood · PHONE SCREENRobinhood interview questions
  • Longest Chain BookingAirbnb · PHONE SCREENAirbnb interview questions
  • Critical Path Through Dependent TasksModular · PHONE SCREEN · ONSITE INTERVIEW
  • Earliest Dataset Readiness in a PipelinexAI · PHONE SCREENxAI interview questions

Citadel interview experiences

  • Citadel Securities Quant Researcher Intern Loop: 1 Experience
  • Citadel Securities Research Engineer Interview: 1 Experience
  • Citadel Securities SWE Intern First Round: 2 Experiences
  • Citadel Securities Experienced SWE Interviews: 1 Experience
  • Citadel SWE Intern Later Rounds and Superday: 13 Experiences
  • Citadel SWE Intern First-Round Questions: 20 Experiences
All Citadel interview questionsSee Citadel hiring insights
Saved
class Solution {
    public int minimumTime(int n, int[][] relations, int[] time) {
      // Write your code here.
    }
}
Checking account…