THE MOST SIMPLE SOLUTION(if you know a few bitman tricks)
I saw a lot of posts for this question and realized mine was easier to understand and was simple.\nIntuition:\n1.  Check every bit of a and b and compare it wit
I saw a lot of posts for this question and realized mine was easier to understand and was simple.\nIntuition:\n1.  Check every bit of **a and b** and compare it with **c** \n    Example 1:\n   ``\n   0010->a(2)\n   0110->b(6)\n   0101->c(5) ``\n   \n\t   Compare **0,0** and **1**(LSBs of the 3 numbers)\n   **We see that atleast one of the bits of a and b(0 and 0) must be flipped to 1 for the result to be c,so we increment the count value by one**.\n   \n   2.   We get the LSB of a number by performing **AND** operation of that number with one.\n\t Eg:   3->0011\n\t **3 AND 1**  -> 0011 & 0001 which is equal to **1** which means LSB is **one** , similarly result will be zero if LSB is zero.\n\t 3. How do we go to the next bit? \n\t Use unsigned right shift operator(**>>>**),this operator shifts the bits one to the right.\n\n```\nclass Solution {\n    public int minFlips(int a, int b, int c) {\n        if((a|b)==c)\n            return 0;\n        \n        int flips=0;\n        \n \xA0 \xA0 \xA0 \xA0while(c!=0 || a!=0 || b!=0 ) //compare bits of the numbers as long as atleast one of them is nonzero\n \xA0 \xA0 \xA0 \xA0{\n            if((c&1)==1)\n            {\n                if((a&1)==0 && (b&1)==0) //if both are zero while c is 1,one flip is needed\n                    flips+=1;\n                \n            }\n            \n            else if((c&1)==0)\n            {\n                if((a&1)==1 && (b&1)==1) //if both are one while c is zero,we need to change both the bits to zero to get the result .So,this requires 2 flips.\n                    flips+=2;\n                \n                else if((a&1)==1 || (b&1)==1) //if one of the bits is one while c is zero,we need to flip it once.\n                    flips+=1;\n                \n            }\n            a>>>=1; //moving through the bits\n            b>>>=1;\n            c>>>=1;\n        }\n       return flips;\n    }\n    \n    \n}\n```
['Java']