FastPrepPrint Schedule
Problems/Print Schedule

Print Schedule

Optiver logoOptiver● HardOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

We have a huge trading system at Optiver, running 20,000+ instances of binaries in production performing various functions. Processes often have dependencies on other processes to input data from various sources and fetch parameters configured in files and databases. Every week we need to start all these processes and also stop them in the correct order. The longer these processes run, the more money we make, so we want to schedule them to run for as long as possible. Scheduling these processes to run correctly and at the correct time is a complex task, which we want you to solve for us.

In this problem, you will be given a list of processes, each with a unique ID PID, a start time S - which is the earliest the process can start, and an end time E - which is the latest the process can end. You will also be given a list of inter-process dependencies, PID1 -> PID2, indicating that PID1 must start strictly before PID2 can start, and PID2 must end strictly before PID1 can end. Time for the week is divided into integer time units that start from 1 and go up to 10^6 (inclusive). The scheduler can only schedule processes to start or stop at the start of a time unit, for example at 1, 2, 1000, 999999 but not at 1.5, 700.1, etc.

Implement printSchedule with two inputs:

  • processes[0, ..., N-1]: an array of start-time and end-time pairs
  • dependencies[0, ..., M-1]: an array of pid1 and pid2 pairs

printSchedule returns the final schedule as one newline-delimited String with N lines, one for each process in ascending order of PID. Each line i (where 1 ≤ i ≤ N) should contain two integers: S, E - the time at which the ith process (i.e., the process that has PID = i) starts and the time at which it ends respectively.

In the case where a correct schedule is not possible, return "IMPOSSIBLE" instead of the N-line schedule.

Note: in a correct schedule, every process is able to run for at least one time unit.

Function

printSchedule(processes: int[][], dependencies: int[][]) → String

Examples

Example 1

processes = [[100, 2100], [110, 2200], [200, 2330]]dependencies = [[1, 2], [3, 2]]return = "100 2100\n201 2099\n200 2330"

Sample Output

100 2100
201 2099
200 2330

Constraints

  • 1 <= N <= 2000, where N = processes.length
  • Each processes[i] is [S, E] with 1 <= S <= E <= 10^6
  • 0 <= M <= 10000, where M = dependencies.length
  • Each dependencies[j] is [PID1, PID2] with 1 <= PID1, PID2 <= N and PID1 != PID2
  • All ordered pairs [PID1, PID2] are unique.

More Optiver interview questions

  • Overheat Prevention ControllerOA · Seen Nov 2026
  • Power Cell BankOA · Seen Nov 2026
  • Count Straight-Line Word Occurrences in a GridOA · Seen Sep 2026
  • Fastest Average Speed over a Rolling KilometerOA · Seen Sep 2026
  • Multi-Level Inventory Storage SystemOA · PHONE SCREEN · Seen Aug 2026
  • Proportional Momentum Investment StatisticsOA · Seen Aug 2026
  • Count Bounded Share TransactionsOA · Seen Aug 2026
  • Count Ordered Size SequencesOA · Seen Aug 2026
  • Profitable Currency Exchange CycleOA · Seen Aug 2026
  • Client Stock Position OperationsPHONE SCREEN · Seen Aug 2026

Similar questions at other companies

  • Alien DictionaryIntuit · OAIntuit interview questions
  • Delivery ServiceInMobi · OAInMobi interview questions
  • Distances to CyclesBelvedere Trading · OA
  • Earliest Dependency ScheduleHeadlands Technologies · OAHeadlands Technologies interview questions
  • Detect a Cycle in Directed Hate RelationshipsArcesium · OAArcesium interview questions
  • Course Schedule IIChainalysis · OAChainalysis interview questions
  • Module Rebuild CostsAirbnb · OAAirbnb interview questions
  • Course Order, Lowest Number FirstNutanix · OANutanix interview questions
  • Validate a Directed GraphShopify · OAShopify interview questions
  • Spreadsheet Formula EvaluatorHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions

Optiver interview experiences

  • Optiver SWE Intern OA: CPU Temperature Simulation: 1 Experience
  • Optiver Trading Intern Market-Making Games: 1 Experience
  • Optiver Quant Trader Intern Technical Interview: 1 Experience
  • Optiver SWE Intern System Design Interview: 15 Experiences
All Optiver interview questionsSee Optiver hiring insights
Saved
class Solution {
    public String printSchedule(int[][] processes, int[][] dependencies) {
      // write your code here
    }

}
Checking account…