Modular Exponentiation | Backtracking | C++ Solution
Modular Exponentiation, is a Backtracking related problem and in this post we will see how we can solve this challenge in C++
Implement pow(A, B) % C.
In other words, given A, B and C, find (AB)%C.
Input : A = 2, B = 3, C = 3 Return : 2 2^3 % 3 = 8 % 3 = 2 even power when neg power if the ans becomes negative
Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @susantabiswas