//
pkg.gl
Category
github.com/SmartsYoung/LeetCode-in-Go
Algorithms
0050.powx-n
package
0.0.0-20210525112244-a601ee6fe7cf
Repository:
https://github.com/smartsyoung/leetcode-in-go.git
Documentation:
pkg.go.dev
Overview
Versions
1
Dependencies
0
Dependents
0
Files
23 SLOC
#
README
50. Pow(x, n)
题目
Implement pow(x, n).
解题思路
注意到指数是整数,所以,可以利用乘法计算幂
总结
o(N)的算法会浪费很多时间,o(lgN)的算法要快的多。