C# O(1) space/time w/o skipping intermediate steps and w/ explanation
\npublic class Solution {\n    public int MinFlips(int a, int b, int c) {\n        var diff = (a | b) ^ c; // what bits are different from expected\n        var
```\npublic class Solution {\n    public int MinFlips(int a, int b, int c) {\n        var diff = (a | b) ^ c; // what bits are different from expected\n        var ones_a = a & diff; // from the bits that were different which are 1s in a, they must all be flipped to 0\n        var ones_b = b & diff; // from the bits that were different which are 1s in b, they must all be flipped to 0\n        var zeros = ~(a | b) & diff // from the bits that were different which zeros in both a and b, they must be flipped in either a or b;\n\n        return count(ones_a) + count(ones_b) + count(zeros); // lets count all the bits needing flipping\n        \n        const int b1 = 0b0101_0101_0101_0101_0101_0101_0101_0101;\n        const int b2 = 0b0011_0011_0011_0011_0011_0011_0011_0011;\n        const int b4 = 0b0000_1111_0000_1111_0000_1111_0000_1111;\n        const int b8 = 0b0000_0000_1111_1111_0000_0000_1111_1111;\n        const int bl = 0b0000_0000_0000_0000_1111_1111_1111_1111;\n\n        // counts the number of 1s in n\n        int count(int n) {\n            // don\'t give up just yet, this is easier magic trick than it seems! \n            // imagine your intiger bits are a stack of 32 playing cards, each either red or black\n            // imagine simultaneously sliding out every other card in the deck to your left starting from the top of the deck while maintaining all the spaces\n            // now shift the new stack of cards on your left one space down so the cards in each deck are parallel\n            // assuming red represents 0\'s and black 1\'s you notice if you add up each parallel pair of cards you will have the number of black cards at each level\n            // now imagine the process of adding each pair of cards together squeezes each pair into 1 new card labeled with a number corresponding to the sum you just found\n            // now squeeze the new deck of 16 cards down so there are no more spaces, and repeat the process once more\n            // you now have 8 cards each constructed from merging 4 cards and each labeled with a number representing the total number of black cards out of the 4\n            // repeat this again, now you have 4 cards,\n            // repeat this again, now you have 2 cards,\n            // repeat this again, now you have 1 card, you notice the number on the card reads how many black cards you had in the original deck\n            // the magic trick is done, the audience roars in a standing ovation, pen and teller stare at you baffled \n            n = (n & b1) + (n >> 1 & b1); \n            n = (n & b2) + (n >> 2 & b2);\n            n = (n & b4) + (n >> 4 & b4);\n            n = (n & b8) + (n >> 8 & b8);\n            return (n & bl) + (n >> 16);\n        }\n    }\n}\n```
[]