Skip to content
DeepForgeby svx
All problems

Next TD3 Actor Update Step

Problem

Return the first step at or after the current step where TD3 fires an actor update.

Actor updates happen on multiples of delay, so return step when step % delay == 0, otherwise advance to the next multiple. A non-positive delay returns 0.

Hint

Delayed policy updates let the critic catch up before the actor moves.

Test cases

case 1
in: [10,2]
expected: 10
case 2
in: [11,2]
expected: 12
case 3
in: [5,3]
expected: 6
case 4
in: [0,4]
expected: 0
case 5
in: [7,0]
expected: 0
Starter codePython
def next_td3_actor_step(step, delay):
    # Your code here
    pass

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