Skip to content

Commit 72c5ac7

Browse files
saksham-chawlasedatguzelsemme
authored andcommitted
Add typing to binary_exp_mod.py (TheAlgorithms#9469)
* Add typing to binary_exp_mod.py * Update binary_exp_mod.py * review changes
1 parent a76b648 commit 72c5ac7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

maths/binary_exp_mod.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def bin_exp_mod(a, n, b):
1+
def bin_exp_mod(a: int, n: int, b: int) -> int:
22
"""
33
>>> bin_exp_mod(3, 4, 5)
44
1
@@ -13,7 +13,7 @@ def bin_exp_mod(a, n, b):
1313
if n % 2 == 1:
1414
return (bin_exp_mod(a, n - 1, b) * a) % b
1515

16-
r = bin_exp_mod(a, n / 2, b)
16+
r = bin_exp_mod(a, n // 2, b)
1717
return (r * r) % b
1818

1919

0 commit comments

Comments
 (0)