hashmap solution