We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf423de commit a76b648Copy full SHA for a76b648
maths/binary_exponentiation.py
@@ -4,15 +4,15 @@
4
# Time Complexity : O(logn)
5
6
7
-def binary_exponentiation(a, n):
+def binary_exponentiation(a: int, n: int) -> int:
8
if n == 0:
9
return 1
10
11
elif n % 2 == 1:
12
return binary_exponentiation(a, n - 1) * a
13
14
else:
15
- b = binary_exponentiation(a, n / 2)
+ b = binary_exponentiation(a, n // 2)
16
return b * b
17
18
0 commit comments