109. implement `Math.pow()`

easy  - accepted / - tried

Can you write your own Math.pow() ? The power would only be integers.

pow(1, 2)// 1pow(2, 10)// 1024pow(4, -1)// 0.25

All inputs are safe.


You can easily solve this problem by multiplying the base one after another, but it is slow. For power of n, it is needed to do the multiplication n times, can you think of a faster solution ?

Bugfree ordinary solution is better than buggy fancy ones.