By Long Luo

# Intuition

This problem is to find a integer raised to the power a very large number whose length may be $200$ or more.

# Brute Froce

We multiply $a$ to itself $b$ times. That is, $a^b = \underbrace{a \times a \dots \times a}_b$.

We can write such code easily.

## Analysis

• Time Complexity: $O(10^mb_i)$, $m$ is the length of array b.
• Space Complexity: $O(1)$

Obiviously, it will exceed time limit, so we have to find a more efficiently algorithm.

# Binary Exponentiation

Recall the Fast Power Algorithm: Binary Exponentiation, we develop a fast power algorithm, so we can use it here directly.

We didn’t need to change the method of fast power.

## Analysis

• Time Complexity: $O(\sum\limits_{i=0}^{m-1} \log b_i)$, $m$ is the length of array $b$.
• Space Complexity: $O(1)$

All suggestions are welcome.
If you have any query or suggestion please comment below.
Please upvote👍 if you like💗 it. Thank you:-)

Explore More Leetcode Solutions. 😉😃💗