Max Min Discussions | Algorithms | HackerRank
  • + 0 comments
    def maxMin(k, arr):
        arr.sort()
        unfairness = set()
        for i in range(len(arr)-k+1):
            unfairness.add(arr[i+k-1] - arr[i])
        return sorted(list(unfairness))[0]