You are given an event log for a system of “pods.” Each event is a pair [status, value]:
status == 1
: Add a new pod with
initial load
=
value
.
status == 2
: Increase the load of
every existing pod
by
value
(a global increment).
status == 3
: Remove the pod with the
smallest current load
and
output/record
that pod’s current load. (For
status == 3
, the
value
field can be ignored.)
Return a list of the loads produced by every status == 3 operation, in order.
Input:
logs = [[1, 5], [1, 2], [2, 3], [3, 0], [3, 0]]
Process:
Output: [5, 8]
status == 3
event will not occur when there are no pods.