Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created August 22, 2013 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksadbek/6309787 to your computer and use it in GitHub Desktop.
Save maksadbek/6309787 to your computer and use it in GitHub Desktop.
#####################################
##########Puzzle#####################
#####################################
read(n,m,f[1..m])
sort(f[1..m])
best = INFINITY
for k=1 to m-n
best = min(best, f[k+n-1]-f[k])
print best
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment