0ms Solution || Bit Manipulation
Intuition\nCheck the bits of $a$ and $b$ are equal to $c$ through $OR(a|b)$ Operation i.e., check if the $a | b = c$.\n\n# Approach\nIf the bit in $c$ is set.\n
# Intuition\nCheck the bits of $a$ and $b$ are equal to $c$ through $OR(a|b)$ Operation i.e., check if the $a | b = c$.\n\n# Approach\nIf the bit in $c$ is **set**.\nThen check if either of the bits in $a$ and $b$ are set, since **atleast** one bit of $a$ is set or $b$ is set then we can make $a|b = c$.\n\nIf the bit in $c$ is **not set**.\nThen check if **none** of the bits in $a$ and $b$ are set, since if a bit is set in either of $a$ or $b$ are set the $OR$ operation will make them set making them not equal to $c$.\n\n\n# Complexity\n- Time complexity: $$O(log(max(a, b, c)))$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int minFlips(int a, int b, int c) {\n        int cnt = 0;\n        while(c || (a | b))\n        {\n            bool cBit = (c&1);\n            bool aBit = (a&1);\n            bool bBit = (b&1);\n            if(cBit)\n            {\n                if(aBit || bBit)\n                {\n                    // Do Nothing\n                }\n                else\n                {\n                    cnt++;\n                }\n            }\n            else\n            {\n                if(aBit)\n                {\n                    cnt++;\n                }\n                if(bBit)\n                {\n                    cnt++;\n                }\n            }\n            a >>= 1;\n            b >>= 1;\n            c >>= 1;\n        }\n        return cnt;\n    }\n};\n```\n\n# Similar Question:\nhttps://leetcode.com/problems/minimum-bit-flips-to-convert-number/description/\n**My Solution:** https://leetcode.com/problems/minimum-bit-flips-to-convert-number/solutions/3608176/0ms-solution-bit-manipulation/
['Bit Manipulation', 'C++']