Build queue blocking cost
A shared CI runner works through its queue one build at a time, starting at minute zero and never idling. Build i occupies the runner for minutes[i], and blocked_engineers[i] people can merge nothing until that build finishes, so each of them waits until the moment it ends. The cost of an order is the sum over builds of blocked_engineers[i] multiplied by that build's finish minute. You may run the queued builds in any order. Return the smallest cost any order achieves. Both lists have the same length, every duration is at least one minute, and at least one engineer waits on every build. An empty queue costs 0. Neither running the shortest build first nor clearing the most blocked build first is always right.
min_blocked_minutes(minutes: list[int], blocked_engineers: list[int]) → int[[4,1],[1,5]]out10[[10,5],[3,1]]out45State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[[4,1],[1,5]]10not run yetsample[[10,5],[3,1]]45not run yetsample