You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def superPow(self, a: int, b: List[int]) -> int:
res = 1
ind = 1
for i in range(len(b) - 1, -1, -1):
v = b[i] * ind
x = a
while v > 0:
if v & 1:
res *= x
res %= 1337
x *= x
x %= 1337
v >>= 1
ind *= 10
return res % 1337
https://www.desgard.com/algo/docs/part2/ch01/2-quick-pow-mod/
快速幂取模算法
The text was updated successfully, but these errors were encountered: