Added functions to determine the gcd of 2 nums

This commit is contained in:
2021-02-07 12:42:35 -05:00
parent 83c35988f2
commit e39a22e298

View File

@@ -220,3 +220,12 @@ def getPermutations(master: str, num: int = 0) -> list:
perms.sort()
#Return the list
return perms
#This function returns the GCD of the two numbers sent to it
def gcd(num1: int, num2: int) -> int:
while((num1 != 0) and (num2 != 0)):
if(num1 > num2):
num1 %= num2
else:
num2 %= num1
return num1 | num2