NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

(This question is a variation of the LeetCode question 276. Paint Fence. If you haven't completed that question yet, it is recommended to solve it first.)

You are a scheduler for a computing cluster. You need to assign nProcesses distinct processes to nIntervals available time slots.

A valid schedule must follow one critical rule: no single process can be assigned to two consecutive time slots.

Test Cases
Input
Output
Expected