Amazon interview question

Ques 1)based on unordered_map Ques 2)based on tree