i copied this || plz solve again
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 
# 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 dfs(self, nums: List[int], idx: int, k: int, mp: defaultdict) -> int:\n        if idx == len(nums):\n            return 1\n\n        taken = 0\n        if mp[nums[idx] - k] == 0 and mp[nums[idx] + k] == 0:\n            mp[nums[idx]] += 1\n            taken = self.dfs(nums, idx + 1, k, mp)\n            mp[nums[idx]] -= 1\n        \n        notTaken = self.dfs(nums, idx + 1, k, mp)\n        \n        return taken + notTaken\n\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        mp = defaultdict(int)\n        ans = self.dfs(nums, 0, k, mp)\n        return ans - 1\n```
['Python3']