The complement of an integer flips every bit of its binary representation (ignoring leading zeros).
Given num, return its complement.
num
num = 5
2
Why
101 → 010
num = 1
0
1 <= num < 2^31
Topics
Implement findComplement in the editor and return the answer — printing it is never graded.
findComplement
Problem 67 of 1146 in the arena