The Little Hash Key that Could

Submitted By:
jmpeck

Difficulty:
Easy

Tags:
hash

Instructions:
Given a hash with numeric values, return the key for the smallest value.

Code:
def key_for_min_value(hash)
  ___
end


assert_equal key_for_min_value({"k" => 2, "h" => 3, "j" => 1}), "j"
assert_equal key_for_min_value({"o" => 0, "z" => -2, "j" => 1}), "z"
assert_equal key_for_min_value({}), nil

Your Solution

Ruby 1.9.3

Back to Problems