CPP | Easy | O(nlogn) Time | O(n) Space
Intuition : Sum of bits will remain constant \n\ntypedef long long ll;\nclass Solution {\npublic:\n    long long countExcellentPairs(vector<int>& v, int k) {\n 
Intuition : Sum of bits will remain constant \n```\ntypedef long long ll;\nclass Solution {\npublic:\n    long long countExcellentPairs(vector<int>& v, int k) {\n        ll ans=0;\n        sort(v.begin(),v.end());\n        v.resize(unique(v.begin(),v.end())-v.begin());\n        int n=v.size();\n        vector<ll> dp(n);\n        for(int i=0;i<n;i++){\n            dp[i]=__builtin_popcount(v[i]);\n        }\n        sort(dp.begin(),dp.end());\n        for(int i=0;i<n;i++){\n            ans+=n-(lower_bound(dp.begin(),dp.end(),k-dp[i])-dp.begin());\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'C', 'Binary Tree', 'C++']