JavaScript solution beats 100% using string
\nvar findComplement = function(num) {\n    var str = num.toString(2);\n    var result = \'\';\n    for (var i of str) {\n      result += i === \'1\'?  \'0\': \
```\nvar findComplement = function(num) {\n    var str = num.toString(2);\n    var result = \'\';\n    for (var i of str) {\n      result += i === \'1\'?  \'0\': \'1\';\n    }\n    return parseInt(result, 2);\n};\n```
[]