permutations2 sol2 with hashmap