You are viewing a single comment's thread. Return to all comments →
Java Solution
Collections.sort(arr); int min=Integer.MAX_VALUE; for(int i=0;i<arr.size()-k+1;i++){ if((arr.get(i+k-1)-arr.get(i))<min) { min=arr.get(i+k-1)-arr.get(i); } } return min; }
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 →
Java Solution