Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-307

Latency SLA Budget

Problem

Compute how many decode tokens fit in a latency SLA: floor((slo_ms - prefill_ms) / decode_ms_per_token).

The signature is latency_sla_budget(prefill_ms, decode_ms_per_token, slo_ms). Return an integer.

Hint

Prefill and decode budgets are usually tracked separately in product SLAs.

Test cases

case 1
in: [50,20,1050]
expected: 50
case 2
in: [50,20,50]
expected: 0
case 3
in: [100,5,200]
expected: 20
case 4
in: [0,10,55]
expected: 5
Starter codePython
def latency_sla_budget(prefill_ms, decode_ms_per_token, slo_ms):
    # Your code here
    pass

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