Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
OneLine => map => reduce solution in Creative category for [old] Count Inversion by woe_from_wit
function countInversion(sequence){
return sequence.slice(1).map((num, i) => {
return sequence.slice(0, i + 1).filter(prev => prev > num).length
}).reduce((a, b) => a + b);
}
July 25, 2016
Comments: