2^N || EASY TO UNDERSTAND || SHORT & SWEET CODE || C++
\nclass Solution {\npublic:\n    void solve(int s,vector<int> &nums,int &k,unordered_map<int,int> &mp,int &ans){\n        if(s==nums.size()){ans++;return;}\n   
```\nclass Solution {\npublic:\n    void solve(int s,vector<int> &nums,int &k,unordered_map<int,int> &mp,int &ans){\n        if(s==nums.size()){ans++;return;}\n        if(mp[nums[s]+k]==0&&mp[nums[s]-k]==0){\n            mp[nums[s]]++;\n            solve(s+1,nums,k,mp,ans);\n            mp[nums[s]]--;\n        }\n        solve(s+1,nums,k,mp,ans);\n    }\n    int beautifulSubsets(vector<int>& nums, int k) {\n        int ans = 0;\n        unordered_map<int,int> mp;\n        solve(0,nums,k,mp,ans);\n        return ans-1;\n    }\n};\n```
['Recursion', 'C', 'C++']