Complexity should be less than O(n);
int noOfBits = 0;
while (number) { noOfBits++; number &= number - 1; }
How to swap ith and jth Bits for a 32-Bit Integer?
For example, 00000001 11001100 becomes 11001100 00000001;
unsigned short swap_bytes(unsigned short x) {
}
input: one two three
output: three two one