You are viewing a single comment's thread. Return to all comments →
cpp
int maxMin(int k, vector<int> arr) { sort(arr.begin(), arr.end()); int mini = INT_MAX; for (int i = 0; i + k - 1 < arr.size(); i++) { mini = min(mini, arr[i + k - 1] - arr[i]); } return mini; }
Seems like cookies are disabled on this browser, please enable them to open this website
Max Min
You are viewing a single comment's thread. Return to all comments →
cpp