Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-185

Early-Stopping Bandit Check

Problem

Decide whether arm A can be stopped because arm B dominates it statistically.

Compute each arm's UCB as mean + c * sqrt(log(total + 1) / n), where total is the combined number of pulls. Return True when arm B's UCB is strictly greater than arm A's, and False when either arm has no pulls.

Hint

The confidence bonus shrinks as an arm collects more pulls.

Test cases

case 1
in: [[1,0.5],[2,1.5],1]
expected: true
case 2
in: [[2,2],[1,1],0.5]
expected: false
case 3
in: [[1],[1],1]
expected: false
case 4
in: [[],[1],1]
expected: false
Starter codePython
def early_stopping_bandit_check(rewards_a, rewards_b, c):
    # Your code here
    pass

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