You are viewing a single comment's thread. Return to all comments →
JS:
function minimumAbsoluteDifference(arr) { return arr.sort((a,b)=>a-b).reduce( ({prev, minDiff}, curr) => { const diff = Math.abs(curr - prev); return { prev: curr, minDiff: diff < minDiff ? diff : minDiff } }, {prev: 0, minDiff: Infinity}).minDiff }
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
JS: