Leetcode Hashmap Based On The Values