Swift reduce 1 liner, brute force
Intuition\n Describe your first thoughts on how to solve this problem. \n\nBrute force with native function\n\n# Code\n\nclass Solution {\n    func beautifulSub
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nBrute force with native function\n\n# Code\n```\nclass Solution {\n    func beautifulSubsets(_ nums: [Int], _ k: Int) -> Int {\n        nums.reduce([[Int]()]) { result, next in\n            result + result\n                .filter { !$0.contains { abs($0 - next) == k } }\n                .map { $0 + [next] }\n        }.count - 1 // minus empty subset\n    }\n}\n```
['Swift']