Case IQ Interview Question

two coding questions. use hashmap