num. Write it in binary without leading zeros, turn every 0 into a 1 and every 1 into a 0, and return the resulting number as a regular integer.
Zero is written as the single digit 0.num=12 → 3
12 is 1100 in binary. Flipping every bit gives 0011, which is 3.
num=1 → 0
1 is a single one bit; flipped, it becomes 0.
num=0 → 1
Zero is written as a single 0 digit, which flips to 1.
num=12
3
Run checks the first 3 tests in your browser. Submit checks all 36 tests on the server, hidden ones included.