Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-193

Simulation Clock Advance

Problem

Advance a discrete-event simulation clock to the next scheduled event strictly after current_time. Return the smallest event time greater than current_time, or current_time when no future event exists.

Hint

Ignore events at or before the current clock.

Test cases

case 1
in: [0,[3,1,2]]
expected: 1
case 2
in: [2,[3,1,2]]
expected: 3
case 3
in: [5,[3,1,2]]
expected: 5
case 4
in: [1,[2,2,3]]
expected: 2
Starter codePython
def clock_advance(current_time, event_times):
    # Your code here
    pass

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