Binary exponentiation with modulo - O(log N) power!
Calculate ab mod m in O(log b) time using bit manipulation!
Key insight: Any number can be expressed as sum of
powers of 2.
Example: 210 = 28 × 22 (since 10 =
1010 in binary)