Modular Arithmetic (Part #1)

Published by jota in

Modify the inefficient code in the Code tab so it can pass the tests.

Examples

mod(base, exp, k) ➞ (base**(2**exp)) % k

mod(10, 1, 99 ) ➞ 1

mod(3, 2, 15 ) ➞ 6

mod(123, 20, 1234 ) ➞ 391

Notes

Try using loops.

Watch a quick demo on how Edabit works.