All problems
Shadow Latency Overhead
Problem
Compute shadow deployment latency overhead as (mean_shadow - mean_primary) / mean_primary. Return 0.0 when either list is empty or the primary mean is 0.
Hint
Shadow traffic does not affect users but still consumes serving capacity.
Test cases
case 1
in: [[10,20],[12,26]]
expected: 0.26666666666666666
case 2
in: [[5],[5]]
expected: 0
case 3
in: [[0,0],[1,1]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def shadow_latency_overhead(primary_latencies, shadow_latencies):
# Your code here
pass4 test cases · run your code against them in the editor