Follow Procedure || Easy || Python3
\n\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:  \n        \n        def count(n,prev):\n            if n == 0:\n          
\n```\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:  \n        \n        def count(n,prev):\n            if n == 0:\n                return 1 \n            ans = 0\n            if prev[nums[n-1]-k] == 0 and prev[nums[n-1]+k] == 0:\n                prev[nums[n-1]] += 1\n                ans += count(n-1,prev) \n                prev[nums[n-1]] -= 1 \n            ans += count(n-1,prev) \n            \n            return ans \n        \n        return count(len(nums),Counter())-1\n                 \n        \n            \n        \n```
['Python3']