Amazon interview question

Hashmap problems for both leetcodes