You are viewing a single comment's thread. Return to all comments →
C++ STL
int minimumAbsoluteDifference(vector<int> arr) { sort(begin(arr), end(arr)); adjacent_difference(begin(arr), end(arr), begin(arr), [](int a, int b){ return abs(a-b); }); return *min_element(begin(arr)+1, end(arr)); }
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++ STL