[C++] Simple C++ Code || O(NlogN) time || No Binary-Search
If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n    long 
# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    long long int Count(int n)\n    {\n        long long int count = 0;\n        while(n) \n        {\n            count += n & 1;\n            n >>= 1;\n        }\n        return count;\n    }\npublic:\n    long long countExcellentPairs(vector<int>& nums, int k) {\n        int n = nums.size();\n        unordered_map<int, int> um;\n        vector<int> sum;\n        long long int ans = 0;\n        for(int i = 0; i < n; i++)\n        {\n            um[nums[i]] = 1;\n        }\n        for(auto &[fst,_] : um)\n        {\n            sum.push_back(Count(fst));\n        }\n        sort(sum.begin(), sum.end());\n        int i = 0, j = sum.size()-1;\n        while(i <= j)\n        {\n            if(sum[i] + sum[j] >= k)\n            {\n                ans += 2*(j - i) + 1;\n                j--;\n            }\n            else\n                i++;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'Bit Manipulation', 'C', 'C++']