Implement a slightly different solution for generating subsets with duplicates in it without using SortedMap.