EASY JAVA SOLUTION BEATING 100% IN 0ms
Approach1.Bitwise Operations:
Extract the last bit of each number using & 1.
Shift the numbers right by 1 (>>) to move to the next bit.2.Logic:
If (bitA | bitB)
# Approach
<!-- Describe your approach to solving the problem. -->
**1.Bitwise Operations:**
Extract the last bit of each number using & 1.
Shift the numbers right by 1 (>>) to move to the next bit.

**2.Logic:**
- If (bitA | bitB) == bitC, no flips are needed.
- If bitC == 0, both bitA and bitB must be 0. Count the flips required to achieve this.
- If bitC == 1, at least one of bitA or bitB must be 1. Count a single flip if both are 0.

**3.Efficiency:**
The loop continues until all bits of a, b, and c are processed, making it efficient for the given constraints.
# Complexity
- Time complexity: O(number of bits)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

![image.png](https://assets.leetcode.com/users/images/daf92875-1dbd-46f8-ab8e-3fffeaff709a_1738042819.0032501.png)

# Code
```java []
class Solution {
    public int minFlips(int a, int b, int c) {
        int flips=0;
        while (a>0||b>0||c>0){
            int bitsA=a&1;
            int bitsB=b&1;
            int bitsC=c&1;
            if((bitsA|bitsB)!=bitsC){
                if(bitsC==0){
                    flips+=bitsA + bitsB; 
                }else{
                    flips+=1;
                }
            }
            a >>= 1;
            b >>= 1;
            c >>= 1;
        }
        return flips;
    }
}
```
![Upvote.PNG](https://assets.leetcode.com/users/images/5bfa248e-c745-4657-a9f0-b0cba7300d28_1738042841.163927.png)

['Bit Manipulation', 'Java']