Fast Exponentiation Game — Binary Exponentiation Challenge
Compute a^b mod m in O(log b) steps by inspecting the exponent binary bits and choosing Square vs. Multiply & Square.
Time Complexity: O(log b)
Study the algorithm · Watch Visualizer · All Algorithm Games