beats 100%. fully explained cpp solution with two approaches.
IntuitionCheck bit by bit.ApproachBit manipulation or modulo operation.Bit manipulationStart from the right most bit and check how many flips are needed to sati
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Check bit by bit.
# Approach
<!-- Describe your approach to solving the problem. -->
Bit manipulation or modulo operation.
### Bit manipulation
Start from the right most bit and check how many flips are needed to satisfy (a || b) = c.
Then right shift a,b,c by 1;
Continue untill a,b,c all becomes 0.

### Modulo operation
For the right most bit perform modulo 2 operation. If it is even then right most bit will be zero. Otherwise 1.
Then similarly check how many flips are needed to satisfy (a || b) = c.
Then divide a,b,c by two. This will also work as right shift. To understand this more clearly you can consider thinking about how binary number system works.
Continue untill a,b,c all becomes 0.
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(N)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(1)
# Code
```cpp []
//modulo operation -->
class Solution {
public:
    int minFlips(int a, int b, int c) {
        int flips = 0;
        while(a > 0 || b > 0 || c > 0) {
            if(c%2 == 0) {
                flips += a%2 + b%2;
            }
            else{
                if(a%2 == 0 && b%2 == 0) flips += 1;
            }
            a /= 2;
            b /= 2;
            c /= 2;
        }
        return flips;
    }
};
```
# Code
```
// Bit manipulation -->
class Solution {
public:
    int minFlips(int a, int b, int c) {
        int flips=0;
        while(a > 0 || b > 0 || c > 0) {
            int bitA = a & 1;
            int bitB = b & 1;
            int bitC = c & 1;
            if(bitC == 0) {
                flips += bitA + bitB;
            }
            else{
                if(bitA == 0 && bitB == 0) flips += 1;
            }
            a >>= 1;
            b >>= 1;
            c >>= 1;
        }
        return flips;
    }
};
```
['C++']