1318. Minimum Flips to Make a OR b Equal to c
https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c
Python
class Solution(object):
def minFlips(self, a, b, c):
count = 0
for i in range(31):
if not (c >> i) & 1:
count += (a >> i) & 1
count += (b >> i) & 1
continue
if ((a >> i) & 1) == 0 and ((b >> i) & 1) == 0:
count += 1
return count