C++ 2 lines, XOR mask
We construct a XOR mask from all ones until it\'s larger or equal than the number. For example, for 100101, the mask will be 111111. And for 1111, the mask will
We construct a XOR mask from all ones until it\'s larger or equal than the number. For example, for ```100101```, the mask will be ```111111```. And for ```1111```, the mask will be ```1111```.\n\nThe result is the XOR operation of the number and the mask.\n```\nint bitwiseComplement(int N, int c = 1) {\n  while (c < N) c = (c << 1) + 1;\n  return N ^ c;\n}\n```
[]