C++ || Set Bits || Easy to understand
Intuition\nThe Inclusion-Exclusion Principle\nbits(num1 OR num2) + bits(num1 AND num2) = bits(num1) + bits(num2)\n\n\nExplanation\nFor all different a in nums,\
Intuition\nThe Inclusion-Exclusion Principle\nbits(num1 OR num2) + bits(num1 AND num2) = bits(num1) + bits(num2)\n\n\nExplanation\nFor all different a in nums,\ncounts its number of bits.\n\nEnumearte the number of bits k1 and k2,\nif k1 + k2 >= k,\nwe accumulate count[k1] * count[k2].\n\nCode  :\n```\nclass Solution {\npublic:\n    long long countExcellentPairs(vector<int>& nums, int k) {\n        long long cnt[30] = {};\n\t\t\n        long long ans = 0;\n        \n        for(int it:unordered_set<int> (begin(nums),end(nums)))\n\t\t{\n            ++cnt[__builtin_popcount(it)];\n        }\n        \n        for(int i=1;i<30;i++){\n            for(int j=1;j<30;j++)\n            {\n                if(i + j >= k)\n                {\n                    ans += cnt[i]*cnt[j];\n                }\n            }\n        }\n        return ans;\n    }\n};\n```\nComplexity\nTime O(nlogn)\nSpace O(n)\n\n**Upvote if you like the solution**
['C']