[Python] 🥇 Clear, Short Backtracking Solution!
Please upvote/favourite/comment if you like this solution!\n\n# Updated Code\n\nclass Solution:\n    def backtrack(self, arr, subset, k, count):\n        for i 
## **Please upvote/favourite/comment if you like this solution!**\n\n# Updated Code\n```\nclass Solution:\n    def backtrack(self, arr, subset, k, count):\n        for i in range(len(arr)):\n            num = arr[i]\n            if num+k not in subset and num-k not in subset:\n                count[0] += 1\n                subset.append(num)\n                self.backtrack(arr[i+1:], subset, k, count)\n                subset.pop()\n    \n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        nums.sort()\n        count = [0]\n        subset = []\n        self.backtrack(nums, subset, k, count)\n        return count[0]\n```\n\n# Complexity\n- Time complexity: $$O(n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->
['Backtracking', 'Python3']