Given two numbers a and b. In one operation you can pick any non negative integer x and either of a or b. Now if you picked a then replace a with a&x else if you picked b then replace b with b&x.
Return the minimum number of operation required to make a and b equal.
Note: Here & represents bitwise AND operation.
Example 1:
Input:
a = 5, b = 12
Output:
2
Explanantion:
In first operation replace 
a = a&4 = 4
after that replace 
b = b&6 = 4
Hence both are same after applying two
operations.
Example 2:
Input: 
a = 100, b = 100
Output: 
0
Explanation: 
Already same.
Your Task:
You don't need to read, input, or print anything. Your task is to complete the function solve( ), which takes two integers a and b as input parameters and returns the answer.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
0 ≤ a, b ≤ 10^{9}

Source: geeksforgeeks | Difficulty: EASY

Starter code: class Solution:

    def solve(self, a : int, b : int) -> int:

        # code here

        



Solutions:
class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			return 0
		if a == 0 or b == 0:
			return 1
		x = a & b
		if a == x or b == x:
			return 1
		return 2


class Solution:

	def solve(self, a: int, b: int) -> int:
		if a & b == a and a & b == b:
			return 0
		elif a & b == a:
			return 1
		elif a & b == b:
			return 1
		else:
			return 2


class Solution:

	def solve(self, a: int, b: int) -> int:
		count = 0
		while a != b:
			if a < b:
				b = b & a
			else:
				a = a & b
			count += 1
		return count


class Solution:

	def solve(self, a: int, b: int) -> int:
		return (a & b != a) + (a & b != b)


class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			return 0
		if a & b != min(a, b):
			return 2
		else:
			return 1


class Solution:

	def solve(self, a: int, b: int) -> int:
		x = a ^ b
		op_count = 0
		if a & x:
			op_count += 1
		if b & x:
			op_count += 1
		return op_count


class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			return 0
		c1 = c2 = 0
		for i in range(28):
			if a >> i & 1 == 1 and b >> i & 1 == 0:
				c1 = 1
			if a >> i & 1 == 0 and b >> i & 1 == 1:
				c2 = 1
		if c1 == c2 == 1:
			return 2
		return 1


class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			return 0
		c = 0
		t1 = a
		t2 = b
		while a != b:
			if a < b:
				b = b & a
			else:
				a = a & b
			c += 1
		return c


class Solution:

	def solve(self, a: int, b: int) -> int:
		x = [2 ** i for i in range(25)]
		if a < b:
			(a, b) = (b, a)
		if a == b:
			return 0
		elif int((a ^ b) & b) == 0:
			return 1
		else:
			return 2


class Solution:

	def solve(self, a: int, b: int) -> int:
		(x, y) = (0, 0)
		while a > 0 or b > 0:
			if a % 2 == 0 and b % 2 == 1:
				x += 1
			elif a % 2 == 1 and b % 2 == 0:
				y += 1
			(a, b) = (a // 2, b // 2)
		return (x > 0) + (y > 0)


class Solution:

	def solve(self, a: int, b: int) -> int:
		c = a & b
		if a == b:
			return 0
		elif c == a or c == b:
			return 1
		else:
			return 2


class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			return 0
		if a == 0 or b == 0:
			return 1
		s = a & b
		if a == s or b == s:
			return 1
		else:
			return 2


import random

class Solution:

	def solve(self, a: int, b: int) -> int:
		if a == b:
			count = 0
		elif a & b == a or a & b == b:
			count = 1
		else:
			count = 2
		return count


class Solution:

	def solve(self, a: int, b: int) -> int:
		ans = a & b
		count = 0
		while a != b:
			x = a
			a = a & ans
			if a == b:
				count += 1
				return count
			if x != a:
				count += 1
			y = b
			b = b & ans
			if a == b:
				count += 1
				return count
			if y != b:
				count += 1
		return count


class Solution:

	def solve(self, a: int, b: int) -> int:
		x = a & b
		n = 0
		while a != b:
			if a > b:
				a = a & x
				n += 1
			if a < b:
				b = b & x
				n += 1
		return n


class Solution:

	def solve(self, a: int, b: int) -> int:
		return (a != b) + (a & b not in (a, b))


class Solution:

	def solve(self, a: int, b: int) -> int:
		t = a & b
		if a == b:
			return 0
		if a == 0 or b == 0:
			return 1
		elif a == t or b == t:
			return 1
		return 2