Given 32-bit unsigned integers, duplicate each bit in-place in the integer.
- ~10001_2~ becomes ~1100000011_2~
- ~11110_2~ becomes ~1111111100_2~
unsigned long long duplicatebits(unsigned long long);
Note: The function parameter is an
unsigned long long instead of an
unsigned int to remove the step of upcasting.
Your function may be called up to ~10^8~ times.