You are viewing a single comment's thread. Return to all comments →
C#
int minimumAbsoluteDifference(List<int> arr) { arr.Sort(); var minDiff = int.MaxValue; for (int i = 0; i < arr.Count - 1; i++) { minDiff = arr[i + 1] - arr[i] < minDiff ? arr[i + 1] - arr[i] : minDiff; } return 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 →
C#