Bits set Logic simple and cool
\nclass Solution {\n\tpublic long countExcellentPairs(int[] arr, int k) {\n\t\tlong temp[] = new long[32];\n        int count = 0;\n\t\tHashSet<Integer> set = n
```\nclass Solution {\n\tpublic long countExcellentPairs(int[] arr, int k) {\n\t\tlong temp[] = new long[32];\n        int count = 0;\n\t\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tset.add(arr[i]);\n\t\t}\n\t\tfor (int val : set) {\n\t\t\ttemp[Integer.bitCount(val)]++;\n\t\t}\n\t\tfor (int i = 0; i < 32; i++) {\n\t\t\tfor (int j = 0; j < 32; j++) {\n\t\t\t\tif (i + j >= k) {\n\t\t\t\t\tcount += temp[i] * temp[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}\n```
['Java']