# Leetcode 372 - Super Pow

`Note:`

- A combination of both
`quick power`

and`mod ops`

. - A formula that you need to know:
`(a * b) % k = (a % k)(b % k) % k`

.- It means that
`num % mod`

`do mod on every factor`

`multiply them all together`

`do mod again on the result`

- Here we need to do some modifications toward
`quickpow`

- Do
`x % mod`

first, so every factor in the following recursion calls is modded. - As for the result, do another
`mod`

.

- Do

`Question:`

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.

`Example:`

1 | Input: a = 2147483647, b = [2,0,0] |

`Code:`

1 | /** |