Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-255

Judge Verbosity Bias

Problem

Sort items by response length, split into the shorter half and the longer half (dropping the middle item when n is odd), and return the mean score of the longer half minus the mean score of the shorter half. Return 0.0 when fewer than two items are given or the two input lengths disagree.

Test cases

case 1
in: [[10,20,30,40],[1,2,3,9]]
expected: 4.5
case 2
in: [[5,5],[1,2]]
expected: 1
case 3
in: [[1],[1]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def verbosity_bias(lengths, scores):
    # Your code here
    pass

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