Modular Fast Exponentiation
1. You are given a number x.Input Format
2. You are given another number n.
3. You are required to calculate x raised to the power n mod 10^9 + 7 in logn complexity.
The first line contains the integer x and n.Output Format
Output an integer in a line containing x^n mod 10^9+7.Question Video
1 <= x <= 10^9Sample Input
0 <= n <= 10^9
10 5Sample Output
100000
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run