All problems
Throughput Saturation
Problem
Find the smallest batch size whose throughput reaches target_ratio times the peak throughput.
The signature is throughput_saturation(batch_sizes, throughputs, target_ratio=0.95). Return the batch size.
Hint
The saturation point marks where adding work stops buying throughput.
Test cases
case 1
in: [[1,2,4,8],[100,180,190,200],0.95]
expected: 4
case 2
in: [[1,2,4,8],[100,180,190,200],1]
expected: 8
case 3
in: [[1,2],[50,100],0.5]
expected: 1
case 4
in: [[1,2,4],[10,18,20],0.9]
expected: 2
Starter codePython
def throughput_saturation(batch_sizes, throughputs, target_ratio=0.95):
# Your code here
pass4 test cases · run your code against them in the editor