Power Mod
Return (base ** exp) % mod. The exponent can be huge, so do not compute the full power. Square the base and halve the exponent repeatedly instead. Do not use the three argument form of pow.
Example 1
base 2
exp 10
mod 1000
returns 24
1024 % 1000 = 24.
Constraints
0 <= base <= 10**60 <= exp <= 10**91 <= mod <= 10**6
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.