Bit Manipulation - Power of Two
What is the worst-case time complexity of checking if a 32-bit integer
n is a power of two using the expression n & (n - 1) == 0?n is a power of two using the expression n & (n - 1) == 0?n & (n - 1) clears the lowest set bit of n.n is a power of two, it has exactly one set bit, so n & (n - 1) equals zero.n's value.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions