Given positive integers a, b, c: return the minimum number of bit flips in a or b to make a OR b == c.
Check each bit position: if c-bit is 1, we need at least one of a-bit or b-bit to be 1 (cost=1 flip if both are 0). If c-bit is 0, both a-bit and b-bit must be 0 (cost = number of 1s among them).
- Iterate over all 32 bit positions.
- Extract bit_a = (a>>i)&1, bit_b = (b>>i)&1, bit_c = (c>>i)&1.
- If bit_c==1 and bit_a==0 and bit_b==0: flips += 1.
- If bit_c==0: flips += bit_a + bit_b.
- Time Complexity: O(32) = O(1)
- Space Complexity: O(1)