Burglary Series (02): Most Valuable Item

Published by Miguel Carvalho in

You call your spouse to inform his/her most precious item is gone! Given an object of stolen items, return the most expensive item on the list.

Examples

mostExpensiveItem({
  piano: 2000,
}) ➞ "piano"

mostExpensiveItem({
  tv: 30,
  skate: 20,
}) ➞ "tv"

mostExpensiveItem({
  tv: 30,
  skate: 20,
  stereo: 50,
}) ➞ "stereo"

Notes

  • There will only be one most valuable item (no ties).
  • The object will always contain at least one item (no empty objects).
Watch a quick demo on how Edabit works.