Skip to content

Commit 73fdfa3

Browse files
committed
fix: remove useless parentheses
1 parent 555cdc9 commit 73fdfa3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/maths/FastExponentiation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public static long fastExponentiation(long base, long exp, long mod) {
5555
while (exp > 0) {
5656
// If exp is odd, multiply the base to the result
5757
if ((exp & 1) == 1) { // exp & 1 checks if exp is odd
58-
result = (result * base) % mod;
58+
result = result * base % mod;
5959
}
6060
// Square the base and halve the exponent
61-
base = (base * base) % mod; // base^2 % mod to avoid overflow
61+
base = base * base % mod; // base^2 % mod to avoid overflow
6262
exp >>= 1; // Right shift exp to divide it by 2
6363
}
6464

0 commit comments

Comments
 (0)