Max Min Discussions | Algorithms | HackerRank
  • + 0 comments
    def maxMin(k, arr):
        # Write your code here
        n = len(arr)
        arr.sort()
        res=[]
        for i in range(n-k+1):
            uf=arr[i+k-1] - arr[i]
            print(uf)
            res.append(uf)
        return min(res)