feat: add gcd at the end of the file
This commit is contained in:
parent
cb4c5516ad
commit
ff830c6fb8
@ -12,3 +12,9 @@ def modulo(left: int, right: int) -> int:
|
|||||||
if right == 0:
|
if right == 0:
|
||||||
raise ValueError('modulo by zero')
|
raise ValueError('modulo by zero')
|
||||||
return left % right
|
return left % right
|
||||||
|
|
||||||
|
|
||||||
|
def gcd(left: int, right: int) -> int:
|
||||||
|
while right:
|
||||||
|
left, right = right, left % right
|
||||||
|
return abs(left)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user