You are viewing a single comment's thread. Return to all comments →
short and simple python solution
n=int(input()) k=int(input()) l=sorted([int(input()) for _ in range(n)]) print(min([abs(l[i+k-1]-l[i]) for i in range(n-k+1)]))
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 →
short and simple python solution