class Solution:
    def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
        # check [4,4,4,1,4]
        nums.sort()
        output = {}
        output[""] = []

        def iter(curr: List[int], fst: int):
            for i in range(fst, len(nums)):
                cur = curr + [nums[i]]
                output[f"{cur}"] = cur
                iter(cur, i + 1)

        iter([], 0)
        return output.values()

49578233fd15d5a6f200abbaedba581c143c0768
<mask token>

class Solution:
    <mask token>

class Solution:

    def subsetsWithDup(self, nums: List[int]) ->List[List[int]]:
        nums.sort()
        output = {}
        output[''] = []

        def iter(curr: List[int], fst: int):
            for i in range(fst, len(nums)):
                cur = curr + [nums[i]]
                output[f'{cur}'] = cur
                iter(cur, i + 1)
        iter([], 0)
        return output.values()

class Solution:
    def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
        # check [4,4,4,1,4]
        nums.sort()
        output = {}
        output[""] = []

        def iter(curr: List[int], fst: int):
            for i in range(fst, len(nums)):
                cur = curr + [nums[i]]
                output[f"{cur}"] = cur
                iter(cur, i + 1)

        iter([], 0)
        return output.values()
