EASY APPROACH||'✔
\n# Code\n\nclass Solution {\npublic:\n    int count;\n    int K;\n    void solve(int idx,vector<int> &nums,map<int,int> &mp)\n    {\n        if(idx>=nums.size(
\n# Code\n```\nclass Solution {\npublic:\n    int count;\n    int K;\n    void solve(int idx,vector<int> &nums,map<int,int> &mp)\n    {\n        if(idx>=nums.size())\n        {\n            count++;\n            return;\n        }\n        solve(idx+1,nums,mp);\n        if(!mp[nums[idx]-K] &&!mp[nums[idx]+K])\n        {\n            mp[nums[idx]]++;\n            solve(idx+1,nums,mp);\n            mp[nums[idx]]--;\n        }\n    }\n    int beautifulSubsets(vector<int>& nums, int k) {\n        count=0;\n        K=k;\n        map<int,int> mp;\n        solve(0,nums,mp);\n        return count-1;\n    }\n};\n```
['Recursion', 'C++']