Easy C++ Solution || Binary Search + Backtracking || Please Upvote!!!
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int solve(int i, int k, int n, vector<int> &nums, vector<int> &dp)\n    {\n        if (i == n)\n        {\n            return 0;\n        }\n        \n        int o1 = 0, o2 = 0;\n        o1 = solve(i + 1, k, n, nums, dp);\n        if (binary_search(dp.begin(), dp.end(), nums[i] - k) == 0)\n        {\n            dp.push_back(nums[i]);\n            o2 = 1 + solve(i + 1, k, n, nums, dp);\n            dp.pop_back();\n        }\n    \n        return o1 + o2;\n    }\n    int beautifulSubsets(vector<int>& nums, int k) {\n        sort(nums.begin(), nums.end());\n        \n        int n = nums.size();\n        vector<int> dp;\n        return solve(0, k, n, nums, dp);\n    }\n};\n```
['C++']