Skip to content
DeepForgeby svx
All problems

Communication Budget

Problem

Compute communication budget usage.

Return [used, remaining] where used = messages_per_step * steps and remaining = budget - used, which may be negative when over budget.

Hint

A negative remaining value means the protocol exceeded its budget.

Test cases

case 1
in: [3,5,20]
expected: [15,5]
case 2
in: [10,3,20]
expected: [30,-10]
case 3
in: [0,100,5]
expected: [0,5]
Starter codePython
def communication_budget(messages_per_step, steps, budget):
    # Your code here
    pass

3 test cases · run your code against them in the editor