← ALL NOTES
Bit Manipulation

1009. Complement of Base 10 Integer

The complement of n flips every bit of its binary representation (no leading zeros). The clean formulation: complement = n XOR mask, where mask is all-ones with exactly the same width as n's binary…

Loading…