Dawn Foods interview question

Scheduling algorithm problem pseudocode is fine