✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - Simple Backtracking\nTime complexi
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - Simple Backtracking\nTime complexity: $$O(n*2^n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def beautifulSubsets(self, a: List[int], k: int) -> int:\n        return (f:=lambda a,b,i:a[i:] and f(a,b,i+1)+(a[i]-k not in b and f(a,b+[a[i]],i+1)) or bool(b))(sorted(a),[],0)\n```\n\n# Code #1.2 - Unwrapped\n```\nclass Solution:\n    def beautifulSubsets(self, a: List[int], k: int) -> int:\n        def f(a, b, i):\n            if i < len(a):\n                result = f(a, b, i+1)\n                if a[i]-k not in b:\n                    result += f(a, b+[a[i]], i+1)\n\n                return result\n\n            return len(b) > 0\n        \n        return f(sorted(a), [], 0)\n```\n\n# Code #2 - Brute Force\nTime complexity: $$O(n*2^n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def beautifulSubsets(self, a: List[int], k: int) -> int:\n        return sum(all(v+k not in b for v in b) for n in range(1,len(a)+1) for b in combinations(a,n))\n```\n\n(Disclaimer 2: all code above is just a product of fantasy packed into one line, it is not claimed to be \'true\' oneliners - please, remind about drawbacks only if you know how to make it better)
['Array', 'Backtracking', 'Recursion', 'Sorting', 'Python', 'Python3']