Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-228

Step Efficiency

Problem

Return the average ratio of optimal to actual steps over trajectories, skipping any trajectory with a non-positive actual count.

Return 0.0 when no trajectory is usable.

Hint

A perfect trajectory has ratio 1.0; longer trajectories lower the average.

Test cases

case 1
in: [[3,4],[5,8]]
expected: 0.55
case 2
in: [[3],[0]]
expected: 0
case 3
in: [[],[]]
expected: 0
case 4
in: [[1,2],[2,2]]
expected: 0.75
Starter codePython
def step_efficiency(optimal_steps, actual_steps):
    # Your code here
    pass

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