Leetcode Problem 1318. Minimum Flips to Make a OR b Equal to c
1318. Minimum Flips to Make a OR b Equal to c
Leetcode Solutions
Bit Manipulation
Initialize answer to 0.
Loop while a, b, or c is not 0:
a. If (c & 1) is 0, add (a & 1) + (b & 1) to answer.
b. If (c & 1) is 1, and both (a & 1) and (b & 1) are 0, increment answer by 1.
c. Right shift a, b, and c by 1.