Max Min Discussions | | HackerRank

Max Min

  • + 0 comments
    def maxMin(k, arr):
        arr.sort()
        diff = []
        for i in range(len(arr)-k+1):
            diff.append(abs(arr[i]-arr[i+k-1]))
        return (min(diff))