You are viewing a single comment's thread. Return to all comments →
Python best solution If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions
def max_min(k, arr): #Time complexity: O(n*log(n)) #Space complexity (ignoring input): O(1) arr.sort() minimum_unfairness = arr[k - 1] - arr[0] for index in range(1, len(arr) - k + 1): if minimum_unfairness > arr[index + k - 1] - arr[index]: minimum_unfairness = arr[index + k - 1] - arr[index] return minimum_unfairness
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 →
Python best solution
If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions