Given two positive integers A and B, find GCD of A and B.
Example 1:
Input: A = 3, B = 6
Output: 3
Explanation: GCD of 3 and 6 is 3
Example 2:
Input: A = 1, B = 1
Output: 1
Explanation: GCD of 1 and 1 is 1
Your Task:  
You don't need to read input or print anything. Complete the function gcd() which takes two positive integers as input parameters and returns an integer.
Expected Time Complexity: O(log(min(A, B)))
Expected Auxiliary Space: O(1) 
Constraints:
1 ≤ A, B ≤ 10^{9}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(log(min(A, B)))
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def gcd(self, A, B):
        # code here

Solutions:
class Solution:

	def gcd(self, A, B):
		if B == 0:
			return abs(A)
		else:
			var = Solution()
			return Solution.gcd(var, B, A % B)


class Solution:

	def gcd(self, A, B):
		while A != B:
			if A > B:
				A -= B
			else:
				B -= A
		return A


class Solution:

	def gcd(self, A, B):
		if A == 0:
			return B
		return self.gcd(B % A, A)


class Solution:

	def gcd(self, A, B):
		while A % B != 0:
			rem = A % B
			A = B
			B = rem
		return B


class Solution:

	def gcd(self, A, B):
		a = A
		b = B
		while b != 0:
			temp = b
			b = a % b
			a = temp
		gcd = a
		return gcd


class Solution:

	def gcd(self, A, B):
		while A > 0 and B > 0:
			if A > B:
				A = A % B
			else:
				B = B % A
		if A == 0:
			return B
		return A


import math as np

class Solution:

	def gcd(self, A, B):
		s = np.gcd(A, B)
		return s


class Solution:

	def gcd(self, A, B):
		maxi = max(A, B)
		mini = min(A, B)
		if mini != 0:
			if maxi % mini == 0:
				return mini
			else:
				return self.gcd(mini, maxi % mini)


class Solution:

	def gcd(self, a, b):
		if a == 0:
			return b
		return self.gcd(b % a, a)


class Solution:

	def gcd(self, A, B):
		while B != 0:
			temp = B
			B = A % B
			A = temp
		return A


class Solution:

	def gcd(self, A, B):
		while B:
			(A, B) = (B, A % B)
		return A


from math import gcd

class Solution:

	def gcd(self, A, B):
		return gcd(A, B)


class Solution:

	@staticmethod
	def gcd(A, B):
		if B == 0:
			return A
		else:
			return Solution.gcd(B, A % B)


def gc(x, y):
	if x >= y:
		pass
	else:
		(x, y) = (y, x)
	if x % y == 0:
		return y
	else:
		return gc(y, x % y)

class Solution:

	def gcd(self, A, B):
		return gc(A, B)


class Solution:

	def gcd(self, a, b):
		while a > 0 and b > 0:
			if a > b:
				a = a % b
			else:
				b = b % a
		if a == 0:
			return b
		return a


class Solution:

	def gcd(self, A, B):
		rem = 1
		if A > B:
			Dividend = A
			Divisor = B
		else:
			Divisor = A
			Dividend = B
		while rem != 0:
			rem = Dividend % Divisor
			if rem != 0:
				Dividend = Divisor
				Divisor = rem
		return Divisor


class Solution:

	def gcd(self, A, B):
		if B == 0:
			return A
		else:
			return ob.gcd(B, A % B)


class Solution:

	def gcd(self, A, B):

		def abc(c, d):
			if c % d == 0:
				return d
			return abc(d, c % d)
		return abc(A, B)


class Solution:

	def gcd(self, A, B):

		def gcdd(A, B):
			if B == 0:
				return A
			else:
				return gcdd(B, A % B)
		return gcdd(A, B)


class Solution:

	def gcd(self, A, B):
		import math
		if A == 0:
			return B
		if A == 0:
			return B
		if A == B:
			return A
		if A > B:
			return math.gcd(A - B, B)
		return math.gcd(A, B - A)


class Solution:

	def gcd(self, A, B):
		rem = 1
		if A > B:
			dividend = A
			devisor = B
		else:
			dividend = B
			devisor = A
		while rem != 0:
			rem = dividend % devisor
			if rem != 0:
				dividend = devisor
				devisor = rem
		return devisor


import math

class Solution:

	def gcd(self, A, B):
		ans = math.gcd(A, B)
		return ans


import math

class Solution:

	def gcd(self, A, B):
		while B != 0:
			temp = B
			B = A % B
			A = temp
		return A


class Solution:

	def gcd(self, A, B):

		def gcdi(a, b):
			if b == 0:
				return a
			else:
				return gcdi(b, a % b)
		return gcdi(A, B)


class Solution:

	def gcd(self, A, B):
		mn = min(A, B)
		mx = max(A, B)
		if mn == 0:
			return mx
		return self.gcd(mn, mx % mn)


class Solution:

	def gcd(self, A, B):
		return hcf(A, B)

def hcf(A, B):
	if A == 0:
		return B
	if B == 0:
		return A
	if A == B:
		return A
	if A > B:
		return hcf(A % B, B)
	elif A < B:
		return hcf(A, B % A)


class Solution:

	def gcd(self, A, B):
		m1 = max(A, B)
		m2 = min(A, B)
		while m2 >= 1:
			temp = m2
			m2 = m1 - m1 // m2 * m2
			m1 = temp
		return m1


import sys
sys.setrecursionlimit(10 ** 9)

class Solution:

	def gcd(self, a, b):
		if b == 0:
			return a
		else:
			return self.gcd(b, a % b)


import math

class Solution:

	def gcd(self, A, B):
		g = math.gcd(A, B)
		return g


class Solution:

	def gcd(self, A, B):
		if A == 0:
			return B
		elif B == 0:
			return A
		while A != B:
			if A > B:
				A = A - B
			elif B > A:
				B = B - A
		return A


import math

class Solution:

	def gcd(self, A, B):
		a = math.gcd(A, B)
		return a


class Solution:

	def gcd(self, m, n):
		r = m % n
		while r:
			(m, n) = (n, r)
			r = m % n
		return n


class Solution:

	def gcd(self, A, B):
		if A > B:
			(A, B) = (B, A)
		if B % A == 0:
			return A
		if A == 1 or B == 1:
			return max(A, B)
		else:
			return self.gcd(B % A, A)


class Solution:

	def gcd(self, A, B):
		while B != 0:
			r = A % B
			A = B
			B = r
		return A


import math as mt

class Solution:

	def gcd(self, A, B):
		return mt.gcd(A, B)