Minimum Flips to Make a OR b Equal to c
MediumBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.You have three positive integers a, b and c. A flip changes one bit of a or b (0 to 1 or 1 to 0). Return the minimum number of flips so that a | b == c (bitwise OR).
a = 2, b = 6, c = 5 → 3 (a = 010, b = 110, c = 101)
a = 4, b = 2, c = 7 → 1
a = 1, b = 2, c = 3 → 0Constraints
1 <= a <= 10^91 <= b <= 10^91 <= c <= 10^9