C++ | O(1) Solution | Explained Solution | using OR
\nclass Solution {\npublic:\n    int minFlips(int a, int b, int c) {\n        int res = 0;\n        for( int i=0; i<32; i++ ) {     // Looping through 32 bits i
```\nclass Solution {\npublic:\n    int minFlips(int a, int b, int c) {\n        int res = 0;\n        for( int i=0; i<32; i++ ) {     // Looping through 32 bits in a int...\n            bool _bita = a&(1<<i);\n            bool _bitb = b&(1<<i);\n            bool _bitc = c&(1<<i);\n            \n            bool aORb = _bita|_bitb;\n            if( (aORb) != _bitc ) {\n                // basically we get 4 cases\n                // (0,0) , (0,1) , (1,0) , (1,1)\n                // but these cases depend on _bitc..\n                // soo , we first check _bitc\n                \n                if( _bitc == 1 ) {    //_bitc == 1 --> cases = (0,0)\n                    res++;\n                } else {              //_bitc == 0 --> cases = (0,0) , (0,1) , (1,0)\n                    if( (_bita == 1 && _bitb == 0) || (_bita == 0 && _bitb == 1) ) {\n                        res++;        // for cases = (1,0) , (0,1)\n                    } else {\n                        res += 2;     // for cases = (0,0)\n                    }\n                }   //all cases are handled...\n                \n            }\n        }\n        \n        return res;\n    }\n};\n```\n\nIf you like ,  UpVote it...
['Bit Manipulation', 'C', 'C++']