📅  最后修改于: 2022-03-11 15:04:46.394000             🧑  作者: Mango
代码示例1
def median(array)
return nil if array.empty?
sorted = array.sort
len = sorted.length
(sorted[(len - 1) / 2] + sorted[len / 2]) / 2
end