Skip to content
DeepForgeby svx
All problems

Divergence Detect In Off-Policy FA

Problem

Detect divergence by checking whether any value in the history exceeds the threshold in absolute value. Return True on the first violation.

Hint

The check is strict: values exactly at the threshold are still considered stable.

Test cases

case 1
in: [[1,2,3],10]
expected: false
case 2
in: [[1,-50,3],10]
expected: true
case 3
in: [[],1]
expected: false
case 4
in: [[100],100]
expected: false
Starter codePython
def divergence_detected(history, threshold):
    # Your code here
    pass

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