Submit solution
Points:
10
Time limit:
2.5s
Memory limit:
64M
Author:
Problem type
Allowed languages
C++, Lisp, Rust
Given 32-bit unsigned integers, duplicate each bit in-place in the integer.
For example:
- becomes
- becomes
Implementation
One function:
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 times.
Comments