Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Iterate through the indices <code>i</code> in the range <code>[0, n - 1]</code>, for each index <code>i</code> count the number of bits in its binary representation. If it is <code>k</code>, add <code>nums[i]</code> to the result.