Robinhood interview question

Some algorithm problems regarding dictionary and heap