Last active
August 14, 2018 15:37
-
-
Save cossio/f6882d2793a4ebe5c5b2b2ef24236803 to your computer and use it in GitHub Desktop.
Find maximum key=>value pair in a Dict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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