All problems
Latency Budget Allocation
Problem
Allocate a latency budget across stages by multiplying the total budget in milliseconds by each stage share. Return the list of per-stage budgets; empty shares return [].
Hint
Splitting an end-to-end latency objective into per-stage budgets makes each team's target explicit.
Test cases
case 1
in: [200,[0.1,0.2,0.7]]
expected: [20,40,140]
case 2
in: [100,[1]]
expected: [100]
case 3
in: [50,[]]
expected: []
case 4
in: [0,[0.5,0.5]]
expected: [0,0]
Starter codePython
def latency_budget_allocation(total_ms, shares):
# Your code here
pass4 test cases · run your code against them in the editor