simple solution c++ trying all subsets 
IntuitionApproachComplexity
Time complexity:
(2exp(n) * n 2)
Space complexity:
o(N)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
(2exp(n) * n 2)

- Space complexity:
- o(N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
bool check (vector<int> & a, int k ){
    int n=a.size();
    for (int i=0;i<n;i++){
        for (int j=i+1; j<n;j++){
            if (abs(a[i]-a[j])==k) return false;
        }
    }
    return true;
}
void f(vector<int> & ans, int & count, vector<int> & nums, int k , int i ){
    int n=nums.size();
    if (i==n){
        if (check(ans, k )){
            count++;
        }
        return;

    }
    ans.push_back(nums[i]);
    f(ans, count,nums,k, i+1);
    ans.pop_back();
    f(ans, count, nums, k, i+1);

}
    int beautifulSubsets(vector<int>& nums, int k) {
        vector<int> ans;
        int count=0;
        f(ans, count, nums, k , 0 );
        return count-1;
        
    }
};
```
['C++']