Python sorting + subset solution
\n# Code\n\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        res = 0\n        n = len(nums)\n        seen = set()\n    
\n# Code\n```\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        res = 0\n        n = len(nums)\n        seen = set()\n        nums.sort()\n        \n        def dfs(subset, ind, s):\n            nonlocal res\n            if ind >= n:\n                res+=1 if len(subset)>0 else 0\n                return\n            \n            if nums[ind]-k not in seen:\n                subset.append(nums[ind])\n                seen.add(nums[ind])\n                dfs(subset, ind+1, s+nums[ind])\n                subset.pop()\n                seen.discard(nums[ind])\n            dfs(subset, ind+1, s)\n        dfs([], 0, 0)\n        return res\n```
['Recursion', 'Sorting', 'Python3']