Try to maki it simple C // C++ // Java beating 100% in each
Intuition\n\nJava []\nclass Solution {\n    public int minFlips(int a, int b, int c) {\n        int ans = 0;\n\n        for (int i = 0; i < 32; i++) {\n        
# Intuition\n![Screenshot 2024-02-14 104548.png](https://assets.leetcode.com/users/images/40f0a145-862d-40cb-9b42-51589d235faf_1707887843.4793284.png)\n```Java []\nclass Solution {\n    public int minFlips(int a, int b, int c) {\n        int ans = 0;\n\n        for (int i = 0; i < 32; i++) {\n            int mask = 0;\n            if (((1 << i) & c) > 0)\n                mask = 1;\n\n            if (mask == 0) {\n                if ((a & (1 << i)) != 0 && (b & (1 << i)) != 0)\n                    ans += 2;\n                else if ((a & (1 << i)) != 0 || (b & (1 << i)) != 0)\n                    ans += 1;\n            } else if (mask == 1) {\n                if ((a & (1 << i)) == 0 && (b & (1 << i)) == 0)\n                    ans += 1;\n            }\n        }\n        return ans;\n    }\n}\n```\n```C++ []\nclass Solution {\npublic:\n    int minFlips(int a, int b, int c) {\n        int ans = 0;\n\n        for (int i = 0; i < 32; i++) {\n            int mask = 0;\n            if (((1 << i) & c) > 0)\n                mask = 1;\n\n            if (mask == 0) {\n                if ((a & (1 << i)) != 0 && (b & (1 << i)) != 0)\n                    ans += 2;\n                else if ((a & (1 << i)) != 0 || (b & (1 << i)) != 0)\n                    ans += 1;\n            } else if (mask == 1) {\n                if ((a & (1 << i)) == 0 && (b & (1 << i)) == 0)\n                    ans += 1;\n            }\n        }\n        return ans;\n    }\n};\n```\n```C []\nint minFlips(int a, int b, int c) {\n    int cnt = 0;\n    while (a || b || c) {\n        bool aa = (a & 1);\n        bool bb = (b & 1);\n        bool cc = (c & 1);\n        if ((aa | bb) != cc) {\n            if (aa && bb)\n                cnt += 2;\n            else\n                cnt++;\n        }\n\n        a = a >> 1;\n        b = b >> 1;\n        c = c >> 1;\n    }\n    return cnt;\n}\n```\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n     O(32) --> O(1)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n     O(1)\n# Code\n```\nclass Solution {\n    public int minFlips(int a, int b, int c) {\n        int ans = 0;\n\n        for (int i = 0; i < 32; i++) {\n            int mask = 0;\n            if (((1 << i) & c) > 0)\n                mask = 1;\n\n            if (mask == 0) {\n                if ((a & (1 << i)) != 0 && (b & (1 << i)) != 0)\n                    ans += 2;\n                else if ((a & (1 << i)) != 0 || (b & (1 << i)) != 0)\n                    ans += 1;\n            } else if (mask == 1) {\n                if ((a & (1 << i)) == 0 && (b & (1 << i)) == 0)\n                    ans += 1;\n            }\n        }\n        return ans;\n    }\n}\n```
['C', 'C++', 'Java']