Skip to content
DeepForgeby svx
All problems

Bandit Best Arm Gap

Problem

Return the suboptimality gap of every arm: max(means) - means[a]. An empty list returns [].

Hint

Small gaps make arms harder to distinguish, so regret bounds depend on them.

Test cases

case 1
in: [[0.2,0.5,0.7]]
expected: [0.49999999999999994,0.19999999999999996,0]
case 2
in: [[1]]
expected: [0]
case 3
in: [[0.3,0.3]]
expected: [0,0]
case 4
in: [[]]
expected: []
Starter codePython
def bandit_best_arm_gap(means):
    # Your code here
    pass

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