The expression n & (n - 1) clears the lowest set bit.
Example: (binary 1100). (binary 1011). (binary 1000).
Count how many times you can apply this operation until becomes . Each operation removes exactly one set bit.
The expression n & (n - 1) clears the lowest set bit.
Example: (binary 1100). (binary 1011). (binary 1000).
Count how many times you can apply this operation until becomes . Each operation removes exactly one set bit.