Skip to content
DeepForgeby svx
All problems

Safe RL Constraint Check

Problem

Check whether the total constraint cost stays within budget.

Return True when sum(costs) <= budget, and False otherwise.

Hint

The budget is inclusive: spending exactly the budget is safe.

Test cases

case 1
in: [[0.1,0.2],0.5]
expected: true
case 2
in: [[1,2,3],5]
expected: false
case 3
in: [[],0]
expected: true
case 4
in: [[0.5,0.5],1]
expected: true
Starter codePython
def safe_rl_constraint_satisfied(costs, budget):
    # Your code here
    pass

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