I have an integer array with some finite number of values. My job is to find the minimum difference between any two elements in the array.
Consider that the array co
sharing the simplest solution.
function FindMin(arr) { //sort the array in increasing order arr.sort((a,b) => { return a-b; }); let min = arr[1]-arr[0]; let n = arr.length; for (var i=0;i