totalSatisfied
to the sum of customers that are satisfied when the owner is not grumpy.maxAdditionalSatisfied
and currentAdditionalSatisfied
to 0.minutes
to iterate over the arrays.currentAdditionalSatisfied
.minutes
, subtract the number of customers at the start of the window if the owner was grumpy at that minute.maxAdditionalSatisfied
with the maximum of itself and currentAdditionalSatisfied
.maxAdditionalSatisfied
to totalSatisfied
to get the final result.