Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation).
Flip operation consists of change any single bit 1 to 0 or change the bit 0 to 1 in their binary representation.
 
Example 1:

Input: a = 2, b = 6, c = 5
Output: 3
Explanation: After flips a = 1 , b = 4 , c = 5 such that (a OR b == c)
Example 2:
Input: a = 4, b = 2, c = 7
Output: 1

Example 3:
Input: a = 1, b = 2, c = 3
Output: 0

 
Constraints:

1 <= a <= 10^9
1 <= b <= 10^9
1 <= c <= 10^9

Difficulty: MEDIUM_HARD
Starter code: class Solution:
    def minFlips(self, a: int, b: int, c: int) -> int:
        

Solutions:
class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		flips = 0
		print(bin(a))
		print(bin(b))
		print(bin(c))
		while a or b or c:
			if c % 2:
				if not (a % 2 or b % 2):
					flips += 1
			else:
				flips += a % 2 + b % 2
			a //= 2
			b //= 2
			c //= 2
		return flips


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		(i, j, k) = (bin(a)[2:], bin(b)[2:], bin(c)[2:])
		maxL = max(len(i), len(j), len(k))
		(i, j, k) = ('0' * (maxL - len(i)) + i, '0' * (maxL - len(j)) + j, '0' * (maxL - len(k)) + k)
		cnt = 0
		for (x, y, z) in zip(i, j, k):
			if z == '1' and x == '0' and (y == '0'):
				cnt += 1
			if z == '0':
				if x == '1':
					cnt += 1
				if y == '1':
					cnt += 1
		return cnt


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		count = 0
		while a or b or c:
			temp = a & 1 | b & 1
			if temp != c & 1:
				if c & 1:
					count += 1
				else:
					if a & 1:
						count += 1
					if b & 1:
						count += 1
			a = a >> 1
			b = b >> 1
			c = c >> 1
		return count


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		a = bin(a)[2:].zfill(32)
		b = bin(b)[2:].zfill(32)
		c = bin(c)[2:].zfill(32)
		count = 0
		for i in range(32):
			temp_a = int(a[i])
			temp_b = int(b[i])
			temp_c = int(c[i])
			if temp_a | temp_b != temp_c:
				if temp_c == 1:
					count += 1
				else:
					if temp_a == 1:
						count += 1
					if temp_b == 1:
						count += 1
		return count


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		res = 0
		for i in range(32):
			mask = 1 << i
			ai = a & mask
			bi = b & mask
			ci = c & mask
			if ci == 0:
				if ai and bi:
					res += 2
				elif ai or bi:
					res += 1
			elif not ai and (not bi):
				res += 1
		return res


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		stra = '{0:b}'.format(a)
		strb = '{0:b}'.format(b)
		strc = '{0:b}'.format(c)
		n = max(len(stra), len(strb), len(strc))
		stra = '0' * (n - len(stra)) + stra
		strb = '0' * (n - len(strb)) + strb
		strc = '0' * (n - len(strc)) + strc
		boolA = [s == '1' for s in stra]
		boolB = [s == '1' for s in strb]
		boolC = [s == '1' for s in strc]
		x = 0
		for i in range(n):
			(A, B, C) = (boolA[i], boolB[i], boolC[i])
			if not (A or B) == C:
				if A and B:
					x += 2
				else:
					x += 1
		return x


class Solution:

	def minFlips(self, a: int, b: int, c: int) -> int:
		flips = 0
		while a or b or c:
			if c & 1 == 0:
				if a & 1:
					flips += 1
				if b & 1:
					flips += 1
			elif a & 1 == 0 and b & 1 == 0:
				flips += 1
			a >>= 1
			b >>= 1
			c >>= 1
		return flips