Try every possible ordering of tasks using backtracking.
With tasks, there are potentially orderings. Even with pruning, this explodes for large inputs.
Can you compute the answer without simulating every schedule?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Try every possible ordering of tasks using backtracking.
With tasks, there are potentially orderings. Even with pruning, this explodes for large inputs.
Can you compute the answer without simulating every schedule?