Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Median by ZoltanOnody
"use strict";
const median = (data) => {
data.sort((a, b) => a-b);
let first = Math.floor(data.length/2);
if(data.length % 2){
return data[first];
}
return (data[first-1] + data[first])/2;
}
July 21, 2016
Comments: