From 97154cfa351e35ddf0727691a92998cfd7be4e5b Mon Sep 17 00:00:00 2001 From: Saksham Chawla <51916697+saksham-chawla@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:00:34 +0530 Subject: [PATCH] Add typing to binary_exp_mod.py (#9469) * Add typing to binary_exp_mod.py * Update binary_exp_mod.py * review changes --- maths/binary_exp_mod.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths/binary_exp_mod.py b/maths/binary_exp_mod.py index df688892d..8893182a3 100644 --- a/maths/binary_exp_mod.py +++ b/maths/binary_exp_mod.py @@ -1,4 +1,4 @@ -def bin_exp_mod(a, n, b): +def bin_exp_mod(a: int, n: int, b: int) -> int: """ >>> bin_exp_mod(3, 4, 5) 1 @@ -13,7 +13,7 @@ def bin_exp_mod(a, n, b): if n % 2 == 1: return (bin_exp_mod(a, n - 1, b) * a) % b - r = bin_exp_mod(a, n / 2, b) + r = bin_exp_mod(a, n // 2, b) return (r * r) % b