Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-192

Lindley Recursion Step

Problem

One step of the Lindley recursion for waiting times in a single-server queue:

W_next = max(0, W + service - interarrival).

Return the next waiting time.

Hint

Wait times cannot go negative: an idle server resets the queue.

Test cases

case 1
in: [2,3,4]
expected: 1
case 2
in: [0,1,5]
expected: 0
case 3
in: [5,2,1]
expected: 6
case 4
in: [1.5,2.5,2]
expected: 2
Starter codePython
def lindley_step(wait, service, interarrival):
    # Your code here
    pass

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