Easy Java Solution Using Bit Manipulation ( Beats : 100 %)
\n# Approach\n Describe your approach to solving the problem. \nBit Manipulation\n\nHope this helps.\nDo Upvote if you like it !!\n\nThanks :)\n\n# Code\n\nclas
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBit Manipulation\n\nHope this helps.\nDo Upvote if you like it !!\n\nThanks :)\n\n# Code\n```\nclass Solution {\n    public int bitwiseComplement(int num) {\n        if(num==0){\n            return 1;\n        }\n        int c=0;\n        c=(int)(Math.log(num)/Math.log(2));\n        num=~num;\n        num =num & (int)((Math.pow(2,c))-1);\n        return(num);\n    }\n}\n```
['Bit Manipulation', 'Java']