Map|| sorting || c++
\nclass Solution {\npublic:\n    int solve(vector<int>& nums,int index,int k,unordered_map<int,int>& s){\n        if(index>=nums.size()){\n            bool foun
```\nclass Solution {\npublic:\n    int solve(vector<int>& nums,int index,int k,unordered_map<int,int>& s){\n        if(index>=nums.size()){\n            bool found=false;\n            for(auto& x:s){\n                if(x.second>0){\n                    found=true;\n                    break;\n                }\n            }\n            if(found)\n            return 1;\n            return 0;\n        }\n        \n        int include=0,notinclude=0;\n        if(!s[nums[index]-k]){\n            s[nums[index]]++;\n            include=solve(nums,index+1,k,s);\n            s[nums[index]]--;\n        }\n        \n        notinclude= solve(nums,index+1,k,s);\n        \n        return include+notinclude;\n    }\n    \n    int beautifulSubsets(vector<int>& nums, int k) {\n        int index=0,prev=-1;\n        sort(nums.begin(),nums.end());\n        \n        unordered_map<int,int> s;\n        return solve(nums,index,k,s);\n    }\n};\n```
['Recursion', 'C', 'Sorting']