Super Pow
Your task is to calculate a^b mod 1337, where a is a positive integer and b is an extremely large positive integer given in the form of an array.
Return the value of a^b mod 1337.
Example 1
Input
a = 2, b = [3]Output
8Since
b represents 3, 2^3 mod 1337 is 8.Example 2
Input
a = 2, b = [1,0]Output
1024Since
b represents 10, 2^10 mod 1337 is 1024.Constraints
- 1 <= a <= 2^31 - 1
- 1 <= b.length <= 2000
- 0 <= b[i] <= 9
- b does not contain leading zeros.