You are given an array of positive integers nums and a positive integer k.
A pair (num1, num2) is defined as excellent if both of the following conditions hold:
Both num1 and num2 are present in nums.
The sum of the number of set bits in (num1 OR num2) and (num1 AND num2) is greater than or equal to k.
Return the total number of distinct excellent pairs.
Note: Two pairs
(a, b)and(c, d)are distinct ifor .
Constraints:
nums.length
nums[i]
k
You are given an array of positive integers nums and a positive integer k.
A pair (num1, num2) is defined as excellent if both of the following conditions hold:
Both num1 and num2 are present in nums.
The sum of the number of set bits in (num1 OR num2) and (num1 AND num2) is greater than or equal to k.
Return the total number of distinct excellent pairs.
Note: Two pairs
(a, b)and(c, d)are distinct ifor .
Constraints:
nums.length
nums[i]
k