C++ SIMPLE EASY NAIVE SOLUTION
\nclass Solution {\npublic:\n    int findComplement(int num) {\n        \n        int x =0;\n        int d=0;\n        string s="";\n        while(num){\n      
```\nclass Solution {\npublic:\n    int findComplement(int num) {\n        \n        int x =0;\n        int d=0;\n        string s="";\n        while(num){\n            s=to_string(num&1) +s;\n            num/=2;\n        }\n        int i = 0;\n        while(i<s.length()){\n            s[i]=s[i]==\'1\'?\'0\':\'1\';\n            i++;\n        }\n        i=s.length()-1;\n        while(i>-1){\n            x+=(s[i]-\'0\')*pow(2,d);\n            i--;\n            d++;\n        }\n        return x;\n        \n    }\n};\n```
[]