All problems
Cold-Start Saving
Problem
Compute the latency saved by caching a warm model: expected = cold * (1 - hit_rate) + warm * hit_rate, and saving = cold - expected.
The signature is cold_start_saving(warm_ms, cold_ms, cache_hit_rate).
Hint
Keeping replicas warm is one of the most effective cold-start mitigations.
Test cases
case 1
in: [100,1000,0.5]
expected: 450
case 2
in: [100,1000,0]
expected: 0
case 3
in: [100,1000,1]
expected: 900
case 4
in: [200,500,0.8]
expected: 240
Starter codePython
def cold_start_saving(warm_ms, cold_ms, cache_hit_rate):
# Your code here
pass4 test cases · run your code against them in the editor