Max Min Discussions | | HackerRank

Max Min

  • + 0 comments

    def maxMin(k, arr):

    dif = []
    arr.sort()
    n = k - 1
    for i in range(len(arr) - k + 1):
        dif.append(arr[n + i] - arr[i])
    return min(dif)