WITHOUT Bit Manipulation | Simple Solution | Easy to Understand  | Detailed Explanation and Analysis
NoteThis solution uses strings to simulate bitwise operations. It is mainly for those who are not familiar with or prefer not to use bit manipulation directly.
# Note
This solution uses strings to simulate bitwise operations. It is mainly for those who are not familiar with or prefer not to use bit manipulation directly. It provides a more intuitive approach while still achieving the same result.
# Intuition
***KINDLY UPVOTE IF THIS SOLUTION HELPS YOU***
To solve the problem where we are asked to determine the minimum number of bit flips required in integers *a* and *b* to satisfy the condition *a OR b=c*, we need to break down the problem based on bitwise operations.
**Bit wise OR operation**
- 1 | 1 = 1
- 1 | 0 = 1
- 0 | 1 = 1
- 0 | 0 = 0

So, the result of a | b will be a bit that is 1 if either a[i] or b[i] is 1 at position i. Otherwise, the result will be 0.
We just need to convert the given numbers to binary and count the number of flips needed to match the condition.

# Approach
<!-- Describe your approach to solving the problem. -->
1. *Binary Representation:*
The first step is to look at the binary form of the integers. Each bit in the binary representation will either 0 or 1. We need to transform the bits of *a* and *b* so that their bitwise OR results in *c*. 

2. *Padding the Binary Strings:*
Since the binary representations of *a, b,* and *c* may have different lengths, we need to ensure they are all the same length by padding them with leading zeros. This ensures that we compare bits in the same positions.

3. *Bit-by-bit Comparison:*
    - If the corresponding bit of c is 0:
    both the bits of a and b should also be 0 to match c. 
If either of the bits of a or b is 1, a flip will be needed.
     - If the corresponding bit of c is 1:
 at least one of the bits of a or b must be 1.
 If both are 0, a flip is required for either a or b to make it 1.

4. *Counting Flips:*
By comparing the bits of *a, b*, and *c* at each position, we can determine if a flip is necessary and how many flips are needed. 
     - if c[i]=0: flip only if a[i]=1 or b[i]=1
     - if c[i]=1: flip only if a[i]=0 and b[i]=0

5. *Result*:
The final result will be the total number of flips required to make *a* and *b* match the desired value of *c*.

# Complexity
- Time complexity: $$O(N)$$
where, N - number of bits in the binary representation of the largest input.

- Space complexity: $$O(N)$$ due storage of binary strings

# Code
```python3 []
class Solution:
    def minFlips(self, a: int, b: int, c: int) -> int:
        # convert int to binary and remove prefix '0b'
        a = bin(a)[2:]
        b = bin(b)[2:]
        c = bin(c)[2:]

        # to find maximum length of the binary strings
        max_len = max(len(a), len(b), len(c))

        # pad the binary strings with 0 to be same length
        a = a.zfill(max_len)
        b = b.zfill(max_len)
        c = c.zfill(max_len)
        
        count = 0 # to keep track of no.of bits to be shifted

        for i in range(max_len): # to check each bit
            if c[i] == '0': 
            # if c[i]=0, then a[i] and b[i] should be 0
                count += int(a[i]) + int(b[i])
            elif a[i] == '0' and b[i] == '0': 
            # if c[i]=1, then either a[i] or b[i] should be 1
                    count += 1
       
        return count

```
```python []
class Solution(object):
    def minFlips(self, a, b, c):
        # convert int to binary and remove prefix '0b'
        a = bin(a)[2:]
        b = bin(b)[2:]
        c = bin(c)[2:]

        # to find maximum length of the binary strings
        max_len = max(len(a), len(b), len(c))

        # pad the binary strings with 0 to be same length
        a = a.zfill(max_len)
        b = b.zfill(max_len)
        c = c.zfill(max_len)
        
        count = 0 # to keep track of no.of bits to be shifted

        for i in range(max_len): # to check each bit
            if c[i] == '0': 
            # if c[i]=0, then a[i] and b[i] should be 0
                count += int(a[i]) + int(b[i])
            elif a[i] == '0' and b[i] == '0': 
            # if c[i]=1, then either a[i] or b[i] should be 1
                    count += 1
       
        return count
```

# PS:
*If you found this solution helpful, please consider upvoting. Your support motivates me to provide more insightful and easy-to-understand solutions!*
['String', 'String Matching', 'Simulation', 'Python', 'Python3']