Company: Citadel SDE intern_28april
Difficulty: medium
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, the result should be returned modulo (10 9 +7). Example Suppose that n_processes = 2, n_intervals = 3. The schedule allocation could look like {A, B, A} or {B, A, B}. Note: All the processes are never-ending, so even if n_intervals is very large, the processes will not end . Function Description Complete the f