Easy Java Solution | 100% fast
Complexity
Time complexity: O(1)

Space complexity: O(1)
Code




<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(1)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```
class Solution {
    public int minFlips(int a, int b, int c) {
        int ans=0;
        int i=0;

        // check bit positon from 0 to 32
        while(i<32){
             //Check if position i'th bit position has 1 in 'c' and 1 in either of 'a' or 'b enters if block.
            if((a%2==c%2 || b%2==c%2) && c%2==1){
                //do nothing
            }
            else if(c%2==0){
                if(a%2==1)
                    ans++;
                if(b%2==1)
                    ans++;
            }
            else{
                ans++;
            }
            //shift right
            a=a>>1; 
            b=b>>1;
            c=c>>1;
            i++;  
        }
        return ans;
    }
}
```
['Bit Manipulation', 'Java']