Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-184

ASHA Rung Promotion

Problem

Select the configurations promoted to the next ASHA rung.

Keep k = max(1, int(len(scores) * keep_fraction)) configurations with the highest scores, breaking ties by the lower index. Return the selected indices in descending score order; an empty score list returns [].

Hint

Even with a tiny keep fraction, at least one configuration advances.

Test cases

case 1
in: [[0.5,0.9,0.1,0.7],0.5]
expected: [1,3]
case 2
in: [[1,1,1],0.34]
expected: [0]
case 3
in: [[0.2],0.1]
expected: [0]
case 4
in: [[2,2,1],0.5]
expected: [0]
Starter codePython
def asha_rung_promotion(scores, keep_fraction):
    # Your code here
    pass

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