Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Fix a <code>bit</code> from the range <code>[0, 31]</code>, then count the number of elements of <code>nums</code> that have <code>bit</code> set in them.
<code>bit</code> is set in integer <code>x</code> if and only if <code>2<sup>bit</sup> AND x == 2<sup>bit</sup></code>, where <code>AND</code> is the bitwise <code>AND</code> operation.