Amazon interview question

A very long question but it involves a hashmap.