From 89a65a861724d2eb8c6a60a9e1655d7af9cdc836 Mon Sep 17 00:00:00 2001 From: Saksham Chawla <51916697+saksham-chawla@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:59:06 +0530 Subject: [PATCH] Add typing to binary_exponentiation.py (#9471) * Add typing to binary_exponentiation.py * Update binary_exponentiation.py * float to int division change as per review --- maths/binary_exponentiation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths/binary_exponentiation.py b/maths/binary_exponentiation.py index 147b4285f..05de939d1 100644 --- a/maths/binary_exponentiation.py +++ b/maths/binary_exponentiation.py @@ -4,7 +4,7 @@ # Time Complexity : O(logn) -def binary_exponentiation(a, n): +def binary_exponentiation(a: int, n: int) -> int: if n == 0: return 1 @@ -12,7 +12,7 @@ def binary_exponentiation(a, n): return binary_exponentiation(a, n - 1) * a else: - b = binary_exponentiation(a, n / 2) + b = binary_exponentiation(a, n // 2) return b * b