FastPrepProcess Scheduling
Problems/Process Scheduling

Process Scheduling

Citadel logoCitadel● EasyOA

Updated Nov 2026

QuestionFunctionExamples

Problem statement

Grace Hopper is famously recognized as the "First Lady of Software." She played a significant role in the creation of the first all-electrical digital computer, UNIVAC (Universal Automatic Computer).

Hopper's responsibilities included developing a process synchronization solution to ensure that never-ending processes experience a bounded wait, i.e., one that never completes. She designed an algorithm where one process cannot occupy consecutive time slots.

To evaluate the performance of this algorithm, Hopper needed to determine the number of ways to allocate n_processes in n_intervals different time intervals according to the algorithm. Since the number of ways can be very large, return the result modulo 10^9 + 7.

Note: All the processes are never-ending, so even if n_intervals is very large, the processes will not end.

Function

processScheduling(n_intervals: int, n_processes: int) → int

Complete the function processScheduling in the editor with the following parameters:

  • n_intervals: the number of time intervals
  • n_processes: the number of processes

Returns int: the number of ways processes can be scheduled in time intervals modulo 10^9 + 7

Examples

Example 1

n_intervals = 3n_processes = 2return = 2

The schedule allocation can look like {A, B, A} or {B, A, B}. These are the two valid allocations for the given inputs, so the answer is 2.

More Citadel Online Assessment questions

  • Speed Up a Slow FunctionOA · PHONE SCREEN · Seen Nov 2026
  • Possible MEX Values After One Optional IncrementOA · Seen Oct 2026
  • Busy IntersectionOA · Seen Sep 2026
  • Shortest Path in an Unweighted GraphOA · Seen Sep 2026
  • Maximize Workday EarningsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Minimum Changes for Palindromic BlocksOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Minimum Image Processing CostOA · Seen Jul 2026
  • Coprime Pick with Change CostOA · Seen Jul 2026
  • Employee With the Most OverlapsOA · Seen Feb 2026
  • Most Employees Working at OnceOA · Seen Feb 2026

Similar questions at other companies

  • Enough Muffins for the LineSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Subarray SumVisa · OAVisa interview questions
  • Drawing EdgeWeRide · OAWeRide interview questions
  • Drawing EdgeIBM · OAIBM interview questions
  • Drawing EdgeSnowflake · OASnowflake interview questions
  • Unique Digits in RangeAgoda · OAAgoda interview questions
  • Ordered Book Displays with a Featured BookIMC Trading · OAIMC Trading interview questions
  • Find Max Number of PairsRoblox · OARoblox interview questions
  • Magic Number Range CounterGraviton · OA

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 processScheduling(int n_intervals, int n_processes) {
      // write your code here
    }
}
Checking account…