minimum - actual
, in ascending order.initial_energy
and current_energy
to 0.current_energy
is less than the minimum
energy required for the current task, calculate the difference and add it to initial_energy
.
b. Update current_energy
to be the maximum of current_energy
and minimum
energy for the current task, then subtract the actual
energy spent on the task.initial_energy
as the minimum initial energy required to finish all tasks.