Given a rectangle of dimensions L x B find the minimum number (N) of identical squares of maximum side that can be cut out from that rectangle so that no residue remains in the rectangle. Also find the dimension K of that square.
Example 1:
Input: L = 2, B = 4
Output: N = 2, K = 2
Explaination: 2 squares of 2x2 dimension.
Example 2:
Input: L = 6, B = 3
Output: N = 2, K = 3
Explaintion: 2 squares of 3x3 dimension. 
Your Task:
You do not need to read input or print anything. Your task is to complete the function minimumSquares() which takes L and B as input parameters and returns a list of 2 integers containing the values of N and K respectively.
Expected Time Complexity: O(log min(L, B))
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ L, B ≤ 10^{9}

Difficulty: EASY
Tags: Combinatorics

Mathematics
Expected Time Complexity: O(log min(L, B))
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def minimumSquares(self, L, B):

        # code here

Solutions:
class Solution:

	def minimumSquares(self, L, B):
		x = L
		y = B
		if x > y:
			(x, y) = (y, x)
		while True:
			if y == 0:
				k = x
				break
			else:
				(x, y) = (y, x % y)
		return [L * B // (k * k), k]


import math

class Solution:

	def minimumSquares(self, L, B):
		gcd = math.gcd(L, B)
		return [L // gcd * (B // gcd), gcd]


import math

class Solution:

	def minimumSquares(self, L, B):
		x = math.gcd(L, B)
		ans = []
		ans.append(L * B // (x * x))
		ans.append(x)
		return ans


class Solution:

	def minimumSquares(self, L, B):

		def gcd(a, b):
			if b == 0:
				return a
			else:
				return gcd(b, a % b)
		K = gcd(L, B)
		N = L // K * (B // K)
		return (N, K)


class Solution:

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

	def minimumSquares(self, L, B):
		k = self.gcd(L, B)
		return (L * B // (k * k), k)


class Solution:

	def gcd(self, m, n):
		if m < n:
			(m, n) = (n, m)
		while m % n != 0:
			(m, n) = (n, m % n)
		return n

	def minimumSquares(self, L, B):
		out = [0, self.gcd(L, B)]
		out[0] = L // out[1] * (B // out[1])
		return out


class Solution:

	def minimumSquares(self, L, B):
		l = L
		b = B
		while l != b:
			if l > b:
				l = l - b
			else:
				b = b - l
		hcf = l
		return (int(L / hcf * (B / hcf)), hcf)


class Solution:

	def minimumSquares(self, L, B):
		mi = min(L, B)
		ma = L + B - mi
		i = 1
		factor = 1
		while i <= mi:
			if mi % i == 0:
				factor = mi / i
				if ma % factor == 0:
					break
			i += 1
		N = int(L / factor * (B / factor))
		K = int(factor)
		return (N, K)


import math

class Solution:

	def minimumSquares(self, a, b):
		k = math.gcd(a, b)
		return (int(a * b / (k * k)), k)


import math

class Solution:

	def minimumSquares(self, L, B):
		square_side = math.gcd(L, B)
		total = L * B // square_side ** 2
		return (total, square_side)


import math

class Solution:

	def minimumSquares(self, L, B):
		K = math.gcd(L, B)
		N = L * B // (K * K)
		return (N, K)


import math

class Solution:

	def minimumSquares(self, L, B):
		if B < L:
			(L, B) = (B, L)
		d = math.gcd(B, L)
		b = B // d
		l = L // d
		return (b * l, d)


import math

class Solution:

	def minimumSquares(self, l, b):
		gcd = math.gcd(l, b)
		res = gcd
		n = l // res * (b // res)
		return (n, res)


class Solution:

	def minimumSquares(self, L, B):

		def gcd(L, B):
			if B == 0:
				return L
			return gcd(B, L % B)
		i = gcd(L, B)
		return [L // i * B // i, i]


class Solution:

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

	def minimumSquares(self, L, B):
		min = max = 0
		if L > B:
			min = B
			max = L
		else:
			min = L
			max = B
		if max % min == 0:
			return [max // min, min]
		else:
			div = self.hcf(min, max)
			return [max * min // (div * div), div]


import math as m

class Solution:

	def minimumSquares(self, L, B):
		K = m.gcd(L, B)
		return (L * B // (K * K), K)


class Solution:

	def minimumSquares(self, L, B):

		def gcd(a, b):
			if b == 0:
				return a
			return gcd(b, a % b)
		K = gcd(L, B)
		n = L * B // (K * K)
		return (n, K)


import math

class Solution:

	def minimumSquares(self, L, B):
		k = math.gcd(L, B)
		n = L // k * (B // k)
		return (n, k)


import math

class Solution:

	def minimumSquares(self, L, B):
		g = math.gcd(L, B)
		return (L * B // g ** 2, g)


import math

class Solution:

	def minimumSquares(self, L, B):
		hcf = math.gcd(L, B)
		rem = L * B // hcf ** 2
		return [rem, hcf]


import math

class Solution:

	def minimumSquares(self, L, B):
		a = math.gcd(L, B)
		b = a * a
		return (L * B // b, a)


from math import *

class Solution:

	def minimumSquares(self, L, B):
		a = L * B
		l = gcd(L, B)
		k = L // l * (B // l)
		return [k, l]


from math import sqrt

class Solution:

	def minimumSquares(self, L, B):
		(a, b) = (L, B) if L > B else (B, L)
		while b:
			(a, b) = (b, a % b)
		return (int(L / a) * int(B / a), a)


import math

class Solution:

	def minimumSquares(self, l, b):
		n = min(l, b)
		t = max(l, b)
		k = math.gcd(l, b)
		return [l * b // (k * k), k]


class Solution:

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

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

	def minimumSquares(self, L, B):
		prod = L * B
		hcf = self.gcd(L, B)
		lcm = L // self.gcd1(L, B) * B
		N = lcm // hcf
		return (N, hcf)


import math

class Solution:

	def minimumSquares(self, l, b):
		(l, b) = (min(l, b), max(l, b))
		if b % l:
			k = math.gcd(l, b)
			return (l * b // (k * k), k)
		else:
			return (b // l, l)


class Solution:

	def gcd(self, x, y):
		if x == 0:
			return y
		return self.gcd(y % x, x)

	def minimumSquares(self, L, B):
		K = self.gcd(L, B)
		N = L * B // (K * K)
		return (N, K)


import math

class Solution:

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

	def minimumSquares(self, L, B):
		b = min(L, B)
		a = max(L, B)
		k = math.gcd(a, b)
		ans = L // k * B // k
		return (ans, k)


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

class Solution:

	def minimumSquares(self, L, B):
		gc = gcd(L, B)
		if gc != 1:
			L = L / gc
			B = B / gc
			return (int(L * B), gc)
		else:
			return (L * B, 1)


class Solution:

	def minimumSquares(self, L, B):

		def gcd(a, b):
			if a == 0:
				return b
			return gcd(b % a, a)
		s = gcd(min(L, B), max(L, B))
		n = L * B // (s * s)
		return [n, s]


import math as mt

class Solution:

	def minimumSquares(self, L, B):
		dim = mt.gcd(L, B)
		num = L * B // dim ** 2
		return (num, dim)


class Solution:

	def minimumSquares(self, L, B):
		(m, M) = (L if L < B else B, B if B > L else L)

		def HCF(x, y):
			while y:
				(x, y) = (y, x % y)
			return abs(x)
		hcf = HCF(M, m)
		return (L * B // (hcf * hcf), hcf)


import math

class Solution:

	def minimumSquares(self, L, B):
		x = math.gcd(L, B)
		k = int(L * B / (x * x))
		l = []
		l.append(k)
		l.append(x)
		return l


import math

class Solution:

	def minimumSquares(self, L, B):
		k = math.gcd(L, B)
		N = L * B // k ** 2
		return [N, k]


import math

class Solution:

	def minimumSquares(self, L, B):
		gcd_ = math.gcd(L, B)
		k = gcd_ ** 2
		result = L * B // k
		return [result, gcd_]


class Solution:

	def minimumSquares(self, L, B):

		def HCF(a, b):
			while b:
				(a, b) = (b, a % b)
			return a
		x = HCF(L, B)
		return [L * B // (x * x), x]


class Solution:

	def minimumSquares(self, L, B):
		min_ = min(L, B)
		max_ = max(L, B)
		while max_ % min_ > 0:
			k = max_ % min_
			max_ = min_
			min_ = k
		return (L * B // (min_ * min_), min_)


class Solution:

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

	def minimumSquares(self, L, B):
		first = self.hcfnaive(L, B)
		second = L * B // (first * first)
		return [second, first]


class Solution:

	def minimumSquares(self, L, B):
		(shortSide, longSide) = (min(L, B), max(L, B))
		while shortSide:
			(shortSide, longSide) = (longSide % shortSide, shortSide)
		return (L * B // (longSide * longSide), longSide)


class Solution:

	def minimumSquares(self, L, B):
		r = max(L, B)
		le = min(L, B)
		while r:
			(le, r) = (r, le % r)
		k = le
		lc = L * B // k
		ans = lc // k
		return (ans, k)


from math import *

class Solution:

	def minimumSquares(self, L, B):
		a = gcd(L, B)
		return [int(L * B / (a * a)), a]


import math

class Solution:

	def minimumSquares(self, L, B):
		K = math.gcd(L, B)
		res = [0, 0]
		N = L * B // (K * K)
		res[0] = N
		res[1] = K
		return res


import math

class Solution:

	def minimumSquares(self, L, B):

		def GCD(x, y):
			while y:
				(x, y) = (y, x % y)
			return abs(x)
		gcd = GCD(max(L, B), min(L, B))
		return [L // gcd * (B // gcd), gcd]


class Solution:

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

	def minimumSquares(self, L, B):
		side = self.gcd(L, B)
		areaOfSquare = side * side
		areaOfRectangle = L * B
		return [areaOfRectangle // areaOfSquare, side]


class Solution:

	def minimumSquares(self, L, B):

		def gcd(a, b):
			if b == 0:
				return a
			return gcd(b, a % b)
		minside = gcd(L, B)
		numsq = L / minside * (B / minside)
		return [int(numsq), minside]


class Solution:

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

	def minimumSquares(self, L, B):
		mn = min(L, B)
		mx = max(L, B)
		gcd = self.gcd(mx, mn)
		return (mx * mn // (gcd * gcd), gcd)