Skip to content

Instantly share code, notes, and snippets.

@cossio
Last active August 14, 2018 15:37
Show Gist options
  • Save cossio/f6882d2793a4ebe5c5b2b2ef24236803 to your computer and use it in GitHub Desktop.
Save cossio/f6882d2793a4ebe5c5b2b2ef24236803 to your computer and use it in GitHub Desktop.
Find maximum key=>value pair in a Dict
function findmaxkey(d::Dict)
maxk,maxv = first(d)
for k in keys(d)
if d[k] > maxv
maxk, maxv = k, d[k]
end
end
return maxk=>maxv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment