Java solution with explanation O(1) time & O(1) space beats 100% time & space
\nclass Solution {\n\tpublic int minFlips(int a, int b, int c) {\n\t\tint res = 0;\n        while(a != 0 || b != 0 || c!= 0){\n            int bitA = a & 1, bit
```\nclass Solution {\n\tpublic int minFlips(int a, int b, int c) {\n\t\tint res = 0;\n        while(a != 0 || b != 0 || c!= 0){\n            int bitA = a & 1, bitB = b & 1, bitC = c & 1;\n            if (bitC == 0) res += (bitA + bitB);\n\t\t\telse if ((bitA | bitB) == 0) res++;\n            \n            a >>= 1; b >>= 1; c >>= 1;\n        }\n\t\treturn res;\n\t}\n}\n\n/*\n * If bitC == 0 => bitA OR bitB == 0 => bitA must be zero and bitB must be zero\n * c = 0: count a, b != 0\n * \n * If bitC == 1 => bitA OR bitB == 1 => bitA must be zero or bitB must be zero\n * => if (bitA ^ bitB) != 0 => need to flip one of them c = 1: count a | b = 0\n */\n ```
[]