PYTHON3 SOLUTION
Bold# Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n-
**Bold**# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        def dfs(i: int) -> None:\n            nonlocal ans\n            if i >= len(nums):\n                ans += 1\n                return\n            dfs(i + 1)\n            if cnt[nums[i] + k] == 0 and cnt[nums[i] - k] == 0:\n                cnt[nums[i]] += 1\n                dfs(i + 1)\n                cnt[nums[i]] -= 1\n\n        ans = -1\n        cnt = Counter()\n        dfs(0)\n        return ans\n        \n```
['Array', 'Backtracking', 'Depth-First Search', 'Recursion', 'Python3']