[Python 3] Iterative BackTracking
\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        q = deque( [([], -1)] )\n        res = 0\n        \n        while q:
```\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        q = deque( [([], -1)] )\n        res = 0\n        \n        while q:\n            cur, idx = q.popleft()\n            res += 1\n            \n            for i in range(idx + 1, len(nums)):\n                if nums[i] - k in cur or nums[i] + k in cur:\n                    continue\n                q.append( (cur + [nums[i]], i) )\n        \n        return res - 1\n```
['Backtracking', 'Breadth-First Search', 'Iterator', 'Python', 'Python3']